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

* Prevent error when path includes no path.

* Add changelog.

(cherry picked from commit 5c5cd2dc4d)
This commit is contained in:
Felix Fontein 2019-01-03 12:34:46 +01:00 committed by Toshio Kuratomi
parent 7ced444af8
commit 4561a5007b
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:
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):
module.fail_json(
name=base_dir,

View file

@ -563,7 +563,7 @@ def main():
except AttributeError:
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):
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,
)
base_dir = os.path.dirname(module.params['path'])
base_dir = os.path.dirname(module.params['path']) or '.'
if not os.path.isdir(base_dir):
module.fail_json(
name=base_dir,

View file

@ -312,7 +312,7 @@ def main():
if not pyopenssl_found:
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):
module.fail_json(
name=base_dir,

View file

@ -271,7 +271,7 @@ def main():
if not pyopenssl_found:
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):
module.fail_json(
name=base_dir,

View file

@ -269,7 +269,7 @@ def main():
if not pyopenssl_found:
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):
module.fail_json(
name=base_dir,