diff options
author | Michael Scherer <misc@zarb.org> | 2016-09-25 23:01:51 +0200 |
---|---|---|
committer | Michael Scherer <mscherer@users.noreply.github.com> | 2016-09-26 19:22:23 +0200 |
commit | 555439497136c127f5146509972b9adbcf8f4442 (patch) | |
tree | 960411be5f7088a1e843f53dcac106d64e1bcf6b /web_infrastructure/letsencrypt.py | |
parent | a42383adc1187f0fda744bbfcab377b7585bade0 (diff) | |
download | ansible-modules-extras-555439497136c127f5146509972b9adbcf8f4442.tar.gz |
Use 'path' type for file arguments
Diffstat (limited to 'web_infrastructure/letsencrypt.py')
-rw-r--r-- | web_infrastructure/letsencrypt.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/web_infrastructure/letsencrypt.py b/web_infrastructure/letsencrypt.py index 6772b524..a43014a8 100644 --- a/web_infrastructure/letsencrypt.py +++ b/web_infrastructure/letsencrypt.py @@ -192,12 +192,11 @@ def get_cert_days(module,cert_file): Return the days the certificate in cert_file remains valid and -1 if the file was not found. ''' - _cert_file = os.path.expanduser(cert_file) - if not os.path.exists(_cert_file): + if not os.path.exists(cert_file): return -1 openssl_bin = module.get_bin_path('openssl', True) - openssl_cert_cmd = [openssl_bin, "x509", "-in", _cert_file, "-noout", "-text"] + openssl_cert_cmd = [openssl_bin, "x509", "-in", cert_file, "-noout", "-text"] _, out, _ = module.run_command(openssl_cert_cmd,check_rc=True) try: not_after_str = re.search(r"\s+Not After\s*:\s+(.*)",out.decode('utf8')).group(1) @@ -293,7 +292,7 @@ class ACMEAccount(object): def __init__(self,module): self.module = module self.agreement = module.params['agreement'] - self.key = os.path.expanduser(module.params['account_key']) + self.key = module.params['account_key'] self.email = module.params['account_email'] self.data = module.params['data'] self.directory = ACMEDirectory(module) @@ -498,8 +497,8 @@ class ACMEClient(object): def __init__(self,module): self.module = module self.challenge = module.params['challenge'] - self.csr = os.path.expanduser(module.params['csr']) - self.dest = os.path.expanduser(module.params['dest']) + self.csr = module.params['csr'] + self.dest = module.params['dest'] self.account = ACMEAccount(module) self.directory = self.account.directory self.authorizations = self.account.get_authorizations() @@ -756,14 +755,14 @@ class ACMEClient(object): def main(): module = AnsibleModule( argument_spec = dict( - account_key = dict(required=True, type='str'), + account_key = dict(required=True, type='path'), account_email = dict(required=False, default=None, type='str'), acme_directory = dict(required=False, default='https://acme-staging.api.letsencrypt.org/directory', type='str'), agreement = dict(required=False, default='https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf', type='str'), challenge = dict(required=False, default='http-01', choices=['http-01', 'dns-01', 'tls-sni-02'], type='str'), - csr = dict(required=True, aliases=['src'], type='str'), + csr = dict(required=True, aliases=['src'], type='path'), data = dict(required=False, no_log=True, default=None, type='dict'), - dest = dict(required=True, aliases=['cert'], type='str'), + dest = dict(required=True, aliases=['cert'], type='path'), remaining_days = dict(required=False, default=10, type='int'), ), supports_check_mode = True, |