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:
parent
d1d9406066
commit
18f7282ccf
3 changed files with 6 additions and 0 deletions
changelogs/fragments
lib/ansible/cli
test/integration/targets/ansible-doc/roles/test_role3/meta
|
@ -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…
Reference in a new issue