Skip to content

Commit

Permalink
Changed last_contract_date to reflect EndOfSvcAttachDate instead of E…
Browse files Browse the repository at this point in the history
…ndOfServiceContractRenewal
  • Loading branch information
uck9 committed Sep 24, 2024
1 parent f5c1c71 commit 8ffee5c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions netbox_lifecycle/management/commands/sync_cisco_hw_eox_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,18 @@ def update_lifecycle_data(self, pid, hardware_type, eox_data):
self.stdout.write(self.style.NOTICE(f"{pid} - has no end_of_security_vul_support_date"))

try:
if not eox_data["EOXRecord"][0]["EndOfServiceContractRenewal"]["value"]:
self.stdout.write(self.style.NOTICE(f"{pid} - has no end_of_service_contract_renewal"))
if not eox_data["EOXRecord"][0]["EndOfSvcAttachDate"]["value"]:
self.stdout.write(self.style.NOTICE(f"{pid} - has no end_of_service_attach_date"))
else:
last_contract_date_string = eox_data["EOXRecord"][0]["EndOfServiceContractRenewal"]["value"]
last_contract_date_string = eox_data["EOXRecord"][0]["EndOfSvcAttachDate"]["value"]
last_contract_date_date = datetime.strptime(last_contract_date_string, '%Y-%m-%d').date()
self.stdout.write(self.style.SUCCESS(f"{pid} - end_of_service_contract_renewal: {last_contract_date_date}"))
self.stdout.write(self.style.SUCCESS(f"{pid} - end_of_service_attach_date: {last_contract_date_date}"))

if hw_lifecycle.last_contract_date != last_contract_date_date:
hw_lifecycle.last_contract_date = last_contract_date_date
value_changed = True
except KeyError:
self.stdout.write(self.style.NOTICE(f"{pid} - has no end_of_service_contract_renewal"))
self.stdout.write(self.style.NOTICE(f"{pid} - has no end_of_service_attach_date"))

try:
if not eox_data["EOXRecord"][0]["LastDateOfSupport"]["value"]:
Expand Down

0 comments on commit 8ffee5c

Please sign in to comment.