Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic conversion to python3 using 2to3. #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ def reconfigure(version):
# * com.df.letsencrypt.host
# * com.df.letsencrypt.email
required_labels = ('letsencrypt.host', 'letsencrypt.email')
if all([label in args.keys() for label in required_labels]):
if all([label in list(args.keys()) for label in required_labels]):
logger.info('letsencrypt support enabled.')

testing = None
if 'letsencrypt.testing' in args:
testing = args['letsencrypt.testing']
if isinstance(testing, basestring):
if isinstance(testing, str):
testing = True if testing.lower() == 'true' else False

client.process(args['letsencrypt.host'].split(','), args['letsencrypt.email'], testing=testing)
Expand All @@ -90,10 +90,10 @@ def reconfigure(version):
logger.debug('forwarding request to docker-flow-proxy ({})'.format(t))
try:
response = dfp_client.get(dfp_client.url(version, '/reconfigure?{}'.format(
'&'.join(['{}={}'.format(k, v) for k, v in request.args.items()]))))
'&'.join(['{}={}'.format(k, v) for k, v in list(request.args.items())]))))
if response.status_code == 200:
break
except Exception, e:
except Exception as e:
logger.error('Error while trying to forward request: {}'.format(e))
logger.debug('waiting for retry')
time.sleep(os.environ.get('RETRY_INTERVAL', 5))
Expand Down
2 changes: 1 addition & 1 deletion app/client_dfple.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def process(self, domains, email, version='1', testing=None):
self.dfp = self.services(self.dfp_service_name)[0]
self.dfp_secrets = self.service_get_secrets(self.dfp)

for domain, certs in certs.items():
for domain, certs in list(certs.items()):

combined = [x for x in certs if '.pem' in x]
if len(combined) == 0:
Expand Down
2 changes: 1 addition & 1 deletion app/client_dfple_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,5 +292,5 @@ def test_secret_created_not_attached(self):
# check secrets found and attached
for d in self.domains:
self.assertTrue(any([d in x.name for x in self.client._secrets]))
print('ee', self.client.dfp_secrets)
print(('ee', self.client.dfp_secrets))
self.assertTrue(any(['{}.pem'.format(d) == x['SecretName'] for x in self.client.dfp_secrets]))
4 changes: 2 additions & 2 deletions app/hooks/ovh/manual-auth-hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
# update the _acme-challenge. subdomain with a TXT record
subdomain = '_acme-challenge.{}'.format(CERTBOT_DOMAIN.replace(OVH_DNS_ZONE, ''))[:-1]
zone = client.post('/domain/zone/{}/record'.format(OVH_DNS_ZONE), fieldType='TXT', subDomain=subdomain, target=CERTBOT_VALIDATION)
print "Record updated : {}".format(zone)
print("Record updated : {}".format(zone))

response = client.post('/domain/zone/{}/refresh'.format(OVH_DNS_ZONE))
print "Zone refreshed : {}".format(response)
print("Zone refreshed : {}".format(response))

# sleep to make sure the change has time to propagate over to DNS
time.sleep(60)
6 changes: 3 additions & 3 deletions app/hooks/ovh/manual-cleanup-hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
# update the _acme-challenge. subdomain with a TXT record
subdomain = '_acme-challenge.{}'.format(CERTBOT_DOMAIN.replace(OVH_DNS_ZONE, ''))[:-1]
zones = client.get('/domain/zone/{}/record'.format(OVH_DNS_ZONE), fieldType='TXT', subDomain=subdomain)
print "zones", zones
print("zones", zones)
if len(zones) == 1:
zone = zones[0]
else:
raise Exception('Could not find domain matching: {}'.format(CERTBOT_DOMAIN))
response = client.delete('/domain/zone/{}/record/{}'.format(OVH_DNS_ZONE, zone))
print "Record deleted : {}".format(response)
print("Record deleted : {}".format(response))

response = client.post('/domain/zone/{}/refresh'.format(OVH_DNS_ZONE))
print "Zone refreshed : {}".format(response)
print("Zone refreshed : {}".format(response))