Skip to content

Commit

Permalink
fix(subscription): Make status lower case
Browse files Browse the repository at this point in the history
The status field was camel case in earlier versions of the API, but was
somehow changed to lower case. To make it compatible with both versions,
make the return value from the API lower case before comparison.

Signed-off-by: Nicolai Buchwitz <nb+github@tipi-net.de>
  • Loading branch information
nbuchwitz committed May 12, 2024
1 parent 4a50ebe commit 84487c3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions check_pve.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,13 +428,13 @@ def check_subscription(self) -> None:
url = self.get_url(f"nodes/{self.options.node}/subscription")
data = self.request(url)

if data["status"] == "NotFound":
if data["status"].lower() == "notfound":
self.check_result = CheckState.WARNING
self.check_message = "No valid subscription found"
if data["status"] == "Inactive":
if data["status"].lower() == "inactive":
self.check_result = CheckState.CRITICAL
self.check_message = "Subscription expired"
elif data["status"] == "Active":
elif data["status"].lower() == "active":
subscription_due_date = data["nextduedate"]
subscription_product_name = data["productname"]

Expand Down

0 comments on commit 84487c3

Please sign in to comment.