Skip to content

Commit

Permalink
Allow empty defaults.yaml and groups.yaml (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers authored Jun 22, 2020
1 parent d911461 commit fd9e8e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nornir_utils/plugins/inventory/yaml_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def load(self) -> Inventory:

if self.defaults_file.exists():
with open(self.defaults_file, "r") as f:
defaults_dict = yml.load(f)
defaults_dict = yml.load(f) or {}
defaults = _get_defaults(defaults_dict)
else:
defaults = Defaults()
Expand All @@ -108,7 +108,7 @@ def load(self) -> Inventory:
groups = Groups()
if self.group_file.exists():
with open(self.group_file, "r") as f:
groups_dict = yml.load(f)
groups_dict = yml.load(f) or {}

for n, g in groups_dict.items():
groups[n] = _get_inventory_element(Group, g, n, defaults)
Expand Down

0 comments on commit fd9e8e8

Please sign in to comment.