Skip to content

Commit

Permalink
Merge pull request #19 from mrjones-plip/fix-gotify-alerts-18
Browse files Browse the repository at this point in the history
fix gotify added vs removed, process all destinations instead of just 1st
  • Loading branch information
mrjones-plip authored Aug 31, 2024
2 parents 63f6482 + 0ec9911 commit 2b056e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def send_alert(user, action, seconds, computer, ssh):
)
except Exception as e:
print(f"Failed to call Gotify. Config is: {alerts}. Error is: {e}")
return False
continue
print(f"Gotify alert sent to {alerts['url']}")
return True
return True


def get_usage(user, computer, ssh):
Expand Down Expand Up @@ -96,9 +96,9 @@ def adjust_time(up_down_string, seconds, ssh, user, computer):
command = conf.ssh_timekpra_bin + ' --settimeleft ' + user + ' ' + up_down_string + ' ' + str(seconds)
ssh.run(command)
if up_down_string == '-':
action = "added"
else:
action = "removed"
else:
action = "added"
print(f"{action} {seconds} for user '{user}'")
try:
send_alert(user, action, seconds, computer, ssh)
Expand Down

0 comments on commit 2b056e0

Please sign in to comment.