edit_monitor() doesn't run code from _build_monitor_data() #3
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: DGNum/uptime-kuma-api#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First, let me say thank you so much for putting this api and accompanying ansible collection together - this is exactly what I was looking for to manage my Uptime Kuma monitors!
The specific issue I am having is that adding a notification to existing monitors wasn't working. Specifically, I was getting this error when running the
edit_monitor()
function.After digging through api.py and a little debugging, I am pretty sure that the issue is that there is some important code included in
_build_monitor_data()
that doesn't get called whenedit_monitor()
is called. For my specific issue, I think this code block is the critical piece. As this looks to be responsible for converting the list/array of integer notification ids to the dictionary of {id: True} that the Uptime Kuma socket API is looking for.However, I am not sure if there might be other code in this section that would be important for other monitor attributes that might be edited via
edit_monitor()
and is currently being missed when that function is called?For completeness, I'll just document that currently
edit_monitor()
simply passes its args todata.update()
, without running the args through the code above to translate the format, which I believe is the root cause of my issue.Using the raw api library, I am able to work around this by calling
edit_monitor()
usingnotificationIDList={1: True}
instead ofnotificationIDList=[1]
, but I don't think that is the intent, is it? This work around doesn't seem to work in ansible sincenotificationIDList
is looking for a list, not a dict. Please let me know if I am just missing something here.Thanks again for putting these packages together, they are really going to help me out.
Thank you, that was exactly the problem. The conversion was missing in the edit_monitor method.