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.
This commit is contained in:
Sam Doran 2021-02-12 17:37:00 -05:00 committed by GitHub
parent d1d9406066
commit 18f7282ccf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View file

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

View file

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