@@ -336,16 +336,20 @@ async def _db_import_system(self, conn, fields: dict, org_id: str, inventory_id:
336336 INSERT INTO system_platform
337337 (rh_account_id, inventory_id, s3_url, vmaas_json, json_checksum, display_name,
338338 stale_timestamp, stale_warning_timestamp, culled_timestamp,
339- host_type, last_upload, stale, operating_system_id, sap_ids, group_set_id, tag_set_id)
339+ host_type, last_upload, stale, operating_system_id, sap_ids, group_set_id, tag_set_id, insights_id, updated_timestamp,
340+ mssql, ansible, rhsm_version)
340341 VALUES (%(rh_account_id)s, %(inventory_id)s, %(s3_url)s, %(vmaas_json)s, %(json_checksum)s, %(display_name)s,
341342 %(stale_timestamp)s, %(stale_warning_timestamp)s, %(culled_timestamp)s,
342- %(host_type)s, %(last_upload)s, 'F', %(operating_system_id)s, %(sap_ids)s, %(group_set_id)s, %(tag_set_id)s)
343+ %(host_type)s, %(last_upload)s, 'F', %(operating_system_id)s, %(sap_ids)s, %(group_set_id)s, %(tag_set_id)s, %(insights_id)s,
344+ %(updated_timestamp)s, %(mssql)s, %(ansible)s, %(rhsm_version)s)
343345 ON CONFLICT (inventory_id) DO UPDATE SET
344346 rh_account_id = EXCLUDED.rh_account_id, inventory_id = EXCLUDED.inventory_id, s3_url = EXCLUDED.s3_url, vmaas_json = EXCLUDED.vmaas_json,
345347 json_checksum = EXCLUDED.json_checksum, display_name = EXCLUDED.display_name, stale_timestamp = EXCLUDED.stale_timestamp,
346348 stale_warning_timestamp = EXCLUDED.stale_warning_timestamp, culled_timestamp = EXCLUDED.culled_timestamp,
347349 host_type = EXCLUDED.host_type, last_upload = EXCLUDED.last_upload, stale = EXCLUDED.stale, operating_system_id = EXCLUDED.operating_system_id,
348- sap_ids = EXCLUDED.sap_ids, group_set_id = EXCLUDED.group_set_id, tag_set_id = EXCLUDED.tag_set_id
350+ sap_ids = EXCLUDED.sap_ids, group_set_id = EXCLUDED.group_set_id, tag_set_id = EXCLUDED.tag_set_id,
351+ insights_id = EXCLUDED.insights_id, updated_timestamp = EXCLUDED.updated_timestamp,
352+ mssql = EXCLUDED.mssql, ansible = EXCLUDED.ansible, rhsm_version = EXCLUDED.rhsm_version
349353 RETURNING (xmax = 0) AS inserted, unchanged_since, last_evaluation, id, when_deleted
350354 """
351355 else :
@@ -364,7 +368,12 @@ async def _db_import_system(self, conn, fields: dict, org_id: str, inventory_id:
364368 operating_system_id = %(operating_system_id)s,
365369 sap_ids = %(sap_ids)s,
366370 group_set_id = %(group_set_id)s,
367- tag_set_id = %(tag_set_id)s
371+ tag_set_id = %(tag_set_id)s,
372+ insights_id = %(insights_id)s,
373+ updated_timestamp = %(updated_timestamp)s,
374+ mssql = %(mssql)s,
375+ ansible = %(ansible)s,
376+ rhsm_version = %(rhsm_version)s
368377 WHERE id = %(system_id)s
369378 RETURNING (xmax = 0) AS inserted, unchanged_since, last_evaluation, id, when_deleted
370379 """
@@ -480,7 +489,16 @@ async def _process_upload(self, msg: InventoryMsg):
480489 groups_checksum , group_set_id = await self ._db_system_group_set_lookup (conn , msg .msg ["host" ]["groups" ])
481490 tags_checksum , tag_set_id = await self ._db_system_tag_set_lookup (conn , msg .msg ["host" ]["tags" ])
482491 system_profile = msg .msg ["host" ].get ("system_profile" , {})
483- sap_ids = system_profile .get ("workloads" , {}).get ("sap" , {}).get ("sids" , [])
492+ workloads = system_profile .get ("workloads" , {})
493+ sap_ids = workloads .get ("sap" , {}).get ("sids" , [])
494+ mssql = bool (workloads .get ("mssql" ))
495+ ansible = bool (workloads .get ("ansible" ))
496+ rhsm_version = system_profile .get ("rhsm" , {}).get ("version" )
497+ insert_fields ["insights_id" ] = msg .msg ["host" ].get ("insights_id" )
498+ insert_fields ["updated_timestamp" ] = msg .msg ["host" ].get ("updated" )
499+ insert_fields ["mssql" ] = mssql
500+ insert_fields ["ansible" ] = ansible
501+ insert_fields ["rhsm_version" ] = rhsm_version
484502 insert_fields ["sap_ids" ] = sap_ids
485503 insert_fields ["operating_system_id" ] = operating_system_id
486504 insert_fields ["group_set_id" ] = group_set_id
0 commit comments