mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
Re-fixing ability to have empty json files after inventory refactoring
This commit is contained in:
@@ -1281,9 +1281,11 @@ def _load_vars_from_path(path, results, vault_password=None):
|
|||||||
# regular file
|
# regular file
|
||||||
elif stat.S_ISREG(pathstat.st_mode):
|
elif stat.S_ISREG(pathstat.st_mode):
|
||||||
data = parse_yaml_from_file(path, vault_password=vault_password)
|
data = parse_yaml_from_file(path, vault_password=vault_password)
|
||||||
if type(data) != dict:
|
if data and type(data) != dict:
|
||||||
raise errors.AnsibleError(
|
raise errors.AnsibleError(
|
||||||
"%s must be stored as a dictionary/hash" % path)
|
"%s must be stored as a dictionary/hash" % path)
|
||||||
|
elif data is None:
|
||||||
|
data = {}
|
||||||
|
|
||||||
# combine vars overrides by default but can be configured to do a
|
# combine vars overrides by default but can be configured to do a
|
||||||
# hash merge in settings
|
# hash merge in settings
|
||||||
|
|||||||
Reference in New Issue
Block a user