theforeman / foreman_ansible_inventory

Foreman dynamic inventory script for ansible - Now merged into Ansible itself
GNU General Public License v3.0
70 stars 31 forks source link

Don't fail if host disappears #12

Closed agx closed 8 years ago

agx commented 8 years ago

A host might disappear once we query its params. Don't fail like

Traceback (most recent call last): File "inventory", line 295, in ForemanInventory() File "inventory", line 52, in init self.update_cache() File "inventory", line 204, in update_cache params = self._resolve_params(host) File "inventory", line 180, in _resolve_params paramgroups += [self._get_params_by_id(host['id'])] File "inventory", line 158, in _get_params_by_id return self._get_json(url) File "inventory", line 137, in _get_json ret.raise_for_status() File "models.py", line 840, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https:parameters?per_page=250&page=1>

in this case. We need to do this for disappearing host groups, locations and organizations as well at a later point but VMs disappaer much more frequently..