1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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

* Prevent error when path includes no path.

* Add changelog.
This commit is contained in:
Felix Fontein 2019-01-03 12:34:46 +01:00 committed by Abhijit Menon-Sen
parent a5bf71ac6a
commit 5c5cd2dc4d
7 changed files with 8 additions and 6 deletions

View file

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

View file

@ -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,

View file

@ -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)

View file

@ -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,

View file

@ -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,

View file

@ -582,7 +582,7 @@ def main():
], ],
) )
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,

View file

@ -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,