openssl_*: prevent error when path includes no path (#50322)

* Prevent error when path includes no path.

* Add changelog.

(cherry picked from commit 5c5cd2dc4d)
pull/50616/head
Felix Fontein 6 years ago committed by Toshio Kuratomi
parent 7ced444af8
commit 4561a5007b

@ -0,0 +1,2 @@
bugfixes:
- "openssl_* - fix error when ``path`` contains a file name without path."

@ -1041,7 +1041,7 @@ def main():
if module.params['provider'] != 'assertonly' and module.params['csr_path'] is None: if module.params['provider'] != 'assertonly' and module.params['csr_path'] is None:
module.fail_json(msg='csr_path is required when provider is not assertonly') module.fail_json(msg='csr_path is required when provider is not assertonly')
base_dir = os.path.dirname(module.params['path']) base_dir = os.path.dirname(module.params['path']) or '.'
if not os.path.isdir(base_dir): if not os.path.isdir(base_dir):
module.fail_json( module.fail_json(
name=base_dir, name=base_dir,

@ -563,7 +563,7 @@ def main():
except AttributeError: except AttributeError:
module.fail_json(msg='You need to have PyOpenSSL>=0.15 to generate CSRs') module.fail_json(msg='You need to have PyOpenSSL>=0.15 to generate CSRs')
base_dir = os.path.dirname(module.params['path']) base_dir = os.path.dirname(module.params['path']) or '.'
if not os.path.isdir(base_dir): if not os.path.isdir(base_dir):
module.fail_json(name=base_dir, msg='The directory %s does not exist or the file is not a directory' % base_dir) module.fail_json(name=base_dir, msg='The directory %s does not exist or the file is not a directory' % base_dir)

@ -191,7 +191,7 @@ def main():
add_file_common_args=True, add_file_common_args=True,
) )
base_dir = os.path.dirname(module.params['path']) base_dir = os.path.dirname(module.params['path']) or '.'
if not os.path.isdir(base_dir): if not os.path.isdir(base_dir):
module.fail_json( module.fail_json(
name=base_dir, name=base_dir,

@ -312,7 +312,7 @@ def main():
if not pyopenssl_found: if not pyopenssl_found:
module.fail_json(msg='The python pyOpenSSL library is required') module.fail_json(msg='The python pyOpenSSL library is required')
base_dir = os.path.dirname(module.params['path']) base_dir = os.path.dirname(module.params['path']) or '.'
if not os.path.isdir(base_dir): if not os.path.isdir(base_dir):
module.fail_json( module.fail_json(
name=base_dir, name=base_dir,

@ -271,7 +271,7 @@ def main():
if not pyopenssl_found: if not pyopenssl_found:
module.fail_json(msg='the python pyOpenSSL module is required') module.fail_json(msg='the python pyOpenSSL module is required')
base_dir = os.path.dirname(module.params['path']) base_dir = os.path.dirname(module.params['path']) or '.'
if not os.path.isdir(base_dir): if not os.path.isdir(base_dir):
module.fail_json( module.fail_json(
name=base_dir, name=base_dir,

@ -269,7 +269,7 @@ def main():
if not pyopenssl_found: if not pyopenssl_found:
module.fail_json(msg='the python pyOpenSSL module is required') module.fail_json(msg='the python pyOpenSSL module is required')
base_dir = os.path.dirname(module.params['path']) base_dir = os.path.dirname(module.params['path']) or '.'
if not os.path.isdir(base_dir): if not os.path.isdir(base_dir):
module.fail_json( module.fail_json(
name=base_dir, name=base_dir,

Loading…
Cancel
Save