ansible-doc - account for empty meta/main.yml (#73590)

* ansible-doc - account for empty meta/main.yml

 from_yaml() will return None when encrounting an empty file.
pull/73593/head
Sam Doran 3 years ago committed by GitHub
parent d1d9406066
commit 18f7282ccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,4 @@
bugfixes:
- >-
ansible-doc - account for an empty ``meta/main.yml`` file when displaying
role information (https://github.com/ansible/ansible/pull/73590)

@ -91,6 +91,8 @@ class RoleMixin(object):
try:
with open(path, 'r') as f:
data = from_yaml(f.read(), file_name=path)
if data is None:
data = {}
return data.get('argument_specs', {})
except (IOError, OSError) as e:
raise AnsibleParserError("An error occurred while trying to read the file '%s': %s" % (path, to_native(e)), orig_exc=e)

Loading…
Cancel
Save