aboutsummaryrefslogtreecommitdiff
path: root/foreman_ansible_inventory.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-02-07 15:21:59 +0100
committerGuido Günther <agx@sigxcpu.org>2016-02-07 15:45:53 +0100
commit95909065ee34ef273444ca96004bc0556c345ea6 (patch)
tree39a62e15e9f55cb4d48d1120a63ebedf7d5ccb68 /foreman_ansible_inventory.py
parent3a09d1a5058a1baf80da84686c219f830a04620a (diff)
Don't fail on host without hostgroup
Diffstat (limited to 'foreman_ansible_inventory.py')
-rwxr-xr-xforeman_ansible_inventory.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/foreman_ansible_inventory.py b/foreman_ansible_inventory.py
index b1c0f19..dd4f5a3 100755
--- a/foreman_ansible_inventory.py
+++ b/foreman_ansible_inventory.py
@@ -144,9 +144,11 @@ class ForemanInventory(object):
return {}
hostgroup = self._get_hostgroup_by_id(hid)
- ancestry = hostgroup.get('ancestry', '').split('/')
- # Append top level hostgroup last to overwrite lower
- # level values
+ ancestry_path = hostgroup.get('ancestry', '')
+ ancestry = ancestry_path.split('/') if ancestry_path is not None else []
+
+ # Append top level hostgroup last to overwrite lower level
+ # values
ancestry.append(hid)
params = {}