associate insights machine id w/ host on fact scan

* Add inisghts fact scan module
* Update fact scan playbook to call new insight fact scan module
* JT run w/ store_facts=True will save scanned facts. We "skim" the
machine_id fact from Insights fact scans and associate it with the host
that the fact scan came from.
This commit is contained in:
Chris Meyers
2017-05-10 15:26:51 -04:00
parent 3099fd7a01
commit b9b0b29d97
5 changed files with 96 additions and 1 deletions

View File

@@ -120,6 +120,12 @@ class FactBrokerWorker(ConsumerMixin):
ret = self._do_fact_scan_create_update(host_obj, module_name, facts, self.timestamp)
if job.store_facts is True:
if module_name == 'insights':
try:
host_obj.insights_machine_id = facts['machine_id']
host_obj.save()
except StandardError:
logger.warn('Failed to find insights machine id in insights fact scan.')
self._do_gather_facts_update(host_obj, module_name, facts, self.timestamp)
message.ack()