diff --git a/awx/main/management/commands/run_fact_cache_receiver.py b/awx/main/management/commands/run_fact_cache_receiver.py index 72f2fce881..4d00f5c157 100644 --- a/awx/main/management/commands/run_fact_cache_receiver.py +++ b/awx/main/management/commands/run_fact_cache_receiver.py @@ -123,15 +123,12 @@ class FactBrokerWorker(ConsumerMixin): if job.store_facts is True: if module_name == 'insights': system_id = facts.get('system_id', None) - if system_id: - host_obj.insights_system_id = system_id - try: - host_obj.save() - except IntegrityError: - host_obj.insights_system_id = None - logger.warn('Inisghts system_id %s not assigned to host %s because it already exists.' % (system_id, host_obj.pk)) - else: - logger.warn('Failed to find insights system id in insights fact scan.') + host_obj.insights_system_id = system_id + try: + host_obj.save() + except IntegrityError: + host_obj.insights_system_id = None + logger.warn('Inisghts system_id %s not assigned to host %s because it already exists.' % (system_id, host_obj.pk)) self._do_gather_facts_update(host_obj, module_name, facts, self.timestamp) message.ack() diff --git a/awx/plugins/library/scan_insights.py b/awx/plugins/library/scan_insights.py index a697cd7d89..b7e625ca6d 100755 --- a/awx/plugins/library/scan_insights.py +++ b/awx/plugins/library/scan_insights.py @@ -52,16 +52,13 @@ def main(): system_uuid = get_system_uuid(INSIGHTS_SYSTEM_ID_FILE) - if system_uuid is not None: - results = { - 'ansible_facts': { - 'insights': { - 'system_id': system_uuid - } + results = { + 'ansible_facts': { + 'insights': { + 'system_id': system_uuid } } - else: - results = dict(skipped=True, msg="Insights system id not found") + } module.exit_json(**results)