Skip to content

Commit

Permalink
Ignore hosts that don't actually exists when applying section vars.
Browse files Browse the repository at this point in the history
  • Loading branch information
fboender committed Mar 6, 2019
1 parent 84c4336 commit f515add
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ansiblecmdb/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ def _apply_section_hosts(self, section, hosts):
"""
for entry in section['entries']:
for hostname in self.expand_hostdef(entry['name']):
if hostname not in hosts:
# Expanded host or child host or something else refers to a
# host that isn't actually defined. Ansible skips this, so
# we will too.
continue
host = hosts[hostname]
for var_key, var_val in entry['hostvars'].items():
host['hostvars'][var_key] = var_val
Expand Down

0 comments on commit f515add

Please sign in to comment.