letsencrypt: fix tests failures (#2360)

reviewable/pr18780/r1
René Moser 9 years ago
parent bb6504c8d3
commit 4874ceefa5

@ -140,7 +140,7 @@ install:
- pip install git+https://github.com/ansible/ansible.git@devel#egg=ansible - pip install git+https://github.com/ansible/ansible.git@devel#egg=ansible
- pip install git+https://github.com/sivel/ansible-testing.git#egg=ansible_testing - pip install git+https://github.com/sivel/ansible-testing.git#egg=ansible_testing
script: script:
- python2.4 -m compileall -fq -x 'cloud/|monitoring/zabbix.*\.py|/dnf\.py|/layman\.py|/maven_artifact\.py|clustering/(consul.*|znode)\.py|notification/pushbullet\.py|database/influxdb/influxdb.*\.py|database/mssql/mssql_db\.py' . - python2.4 -m compileall -fq -x 'cloud/|monitoring/zabbix.*\.py|/dnf\.py|/layman\.py|/maven_artifact\.py|clustering/(consul.*|znode)\.py|notification/pushbullet\.py|database/influxdb/influxdb.*\.py|database/mssql/mssql_db\.py|/letsencrypt\.py' .
- python2.6 -m compileall -fq . - python2.6 -m compileall -fq .
- python2.7 -m compileall -fq . - python2.7 -m compileall -fq .
- python3.4 -m compileall -fq . -x $(echo "$PY3_EXCLUDE_LIST"| tr ' ' '|') - python3.4 -m compileall -fq . -x $(echo "$PY3_EXCLUDE_LIST"| tr ' ' '|')

@ -47,6 +47,8 @@ description:
- "Although the defaults are choosen so that the module can be used with - "Although the defaults are choosen so that the module can be used with
the Let's Encrypt CA, the module can be used with any service using the ACME the Let's Encrypt CA, the module can be used with any service using the ACME
protocol." protocol."
requirements:
- "python >= 2.6"
options: options:
account_key: account_key:
description: description:
@ -214,7 +216,7 @@ def write_file(module, dest, content):
f = open(tmpsrc, 'wb') f = open(tmpsrc, 'wb')
try: try:
f.write(content) f.write(content)
except Exception, err: except Exception as err:
os.remove(tmpsrc) os.remove(tmpsrc)
module.fail_json(msg="failed to create temporary content file: %s" % str(err)) module.fail_json(msg="failed to create temporary content file: %s" % str(err))
f.close() f.close()
@ -246,7 +248,7 @@ def write_file(module, dest, content):
try: try:
shutil.copyfile(tmpsrc, dest) shutil.copyfile(tmpsrc, dest)
changed = True changed = True
except Exception, err: except Exception as err:
os.remove(tmpsrc) os.remove(tmpsrc)
module.fail_json(msg="failed to copy %s to %s: %s" % (tmpsrc, dest, str(err))) module.fail_json(msg="failed to copy %s to %s: %s" % (tmpsrc, dest, str(err)))
os.remove(tmpsrc) os.remove(tmpsrc)
@ -350,7 +352,7 @@ class ACMEAccount(object):
try: try:
payload64 = nopad_b64(self.module.jsonify(payload).encode('utf8')) payload64 = nopad_b64(self.module.jsonify(payload).encode('utf8'))
protected64 = nopad_b64(self.module.jsonify(protected).encode('utf8')) protected64 = nopad_b64(self.module.jsonify(protected).encode('utf8'))
except Exception, e: except Exception as e:
self.module.fail_json(msg="Failed to encode payload / headers as JSON: {0}".format(e)) self.module.fail_json(msg="Failed to encode payload / headers as JSON: {0}".format(e))
openssl_sign_cmd = [self._openssl_bin, "dgst", "-sha256", "-sign", self.key] openssl_sign_cmd = [self._openssl_bin, "dgst", "-sha256", "-sign", self.key]

Loading…
Cancel
Save