Skip to content

Commit

Permalink
fix: Creating inventory with None host
Browse files Browse the repository at this point in the history
The code in create_invetory method was looping hostnames from the DB,
which some of them may have already been deleted, which cause a None return
when trying to get their metadata.

This fixes traceback caused by rerunning mrack up with a different host name
without previously deleting mrackdb.json

Signed-off-by: David Pascual <[email protected]>
  • Loading branch information
dav-pascual committed May 12, 2022
1 parent 1fe8a4b commit 8282039
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mrack/outputs/ansible_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ def create_inventory(self):

for host in provisioned.values():
meta_host, _meta_domain = get_host_from_metadata(self._metadata, host.name)
if meta_host is None:
continue

# Groups can be defined in both "groups" and "group" variable.
groups = meta_host.get("groups", [])
Expand Down

0 comments on commit 8282039

Please sign in to comment.