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 <[email protected]>
  • Loading branch information
nbuchwitz committed May 12, 2024
1 parent eeadf51 commit 86805df
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 86805df

Please sign in to comment.