diff options
-rwxr-xr-x | foreman_ansible_inventory.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/foreman_ansible_inventory.py b/foreman_ansible_inventory.py index eefed52..bba2cdd 100755 --- a/foreman_ansible_inventory.py +++ b/foreman_ansible_inventory.py @@ -176,7 +176,9 @@ class ForemanInventory(object): def _get_all_params_by_id(self, hid): url = "%s/api/v2/hosts/%s" % (self.foreman_url, hid) - return self._get_json(url, [404]).get('all_parameters', {}) + ret = self._get_json(url, [404]) + if ret == []: ret = {} + return ret.get('all_parameters', {}) def _get_facts_by_id(self, hid): url = "%s/api/v2/hosts/%s/facts" % (self.foreman_url, hid) |