Skip to content

Commit

Permalink
fix(advisor-listener): don't update stale timestamps with advisor data
Browse files Browse the repository at this point in the history
  • Loading branch information
tkasparek authored and jdobes committed Feb 20, 2020
1 parent 2d326ca commit b390841
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions advisor_listener/advisor_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,13 @@ def db_import_system_platform(cur, system_data: dict):
rh_account_id = cur.fetchone()[0]

cur.execute("""INSERT INTO system_platform
(inventory_id, rh_account_id, display_name,
stale_timestamp, stale_warning_timestamp, culled_timestamp, stale)
VALUES (%s, %s, %s, %s, %s, %s, 'F')
(inventory_id, rh_account_id, display_name)
VALUES (%s, %s, %s)
ON CONFLICT (inventory_id) DO UPDATE SET
rh_account_id = %s, display_name = %s,
stale_timestamp = %s, stale_warning_timestamp = %s, culled_timestamp = %s, stale = 'F'
rh_account_id = %s, display_name = %s
RETURNING (xmax = 0) AS inserted, id, opt_out""",
(system_data['inventory_id'], rh_account_id, system_data['display_name'], system_data['stale_timestamp'],
system_data['stale_warning_timestamp'], system_data['culled_timestamp'],
rh_account_id, system_data['display_name'], system_data['stale_timestamp'], system_data['stale_warning_timestamp'],
system_data['culled_timestamp']))
(system_data['inventory_id'], rh_account_id, system_data['display_name'],
rh_account_id, system_data['display_name']))

inserted, system_id, opt_out = cur.fetchone()
if inserted:
Expand Down Expand Up @@ -235,11 +231,8 @@ def process_message(msg):
# TODO: insert system into database if it's 1st upload, shall we update last seen?
system_data = {
'rh_account': msg_dict['input']['host']['account'],
'culled_timestamp': msg_dict['input']['host']['culled_timestamp'],
'display_name': msg_dict['input']['host']['display_name'],
'inventory_id': msg_dict['input']['host']['id'],
'stale_timestamp': msg_dict['input']['host']['stale_timestamp'],
'stale_warning_timestamp': msg_dict['input']['host']['stale_warning_timestamp']
'inventory_id': msg_dict['input']['host']['id']
}

rule_hits = {}
Expand Down

0 comments on commit b390841

Please sign in to comment.