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:
parent
a5bf71ac6a
commit
5c5cd2dc4d
7 changed files with 8 additions and 6 deletions
2
changelogs/fragments/50322-openssl-path-error.yml
Normal file
2
changelogs/fragments/50322-openssl-path-error.yml
Normal file
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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…
Reference in a new issue