-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve meraki webhook fail when none defined #436
Changes from 4 commits
e3dc5d7
af21031
92a2efc
12fa186
16c45a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfix: | ||
- Resolved an issue where an empty response from the API triggered an exception in module meraki_webhook |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,22 @@ | |
net_name: '{{test_net_name}}' | ||
type: appliance | ||
|
||
- name: Query for any webhooks expecting None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overall this looks good but should there be a new test looking for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can certainly use the opportunity to call out the expected behaviour via the test cases yes. that's probably just the de-commenting of the idempotency tests and tightening the assert statements.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
API behaviour - if the shared secret is not set in the request, then the API will still return 200 OK - it does not touch the secret - only updating any changed params. (verified through GUI/Postman) module behaviour - if the shared secret param is not set, the module will set shared secret to null, and send that - API will return 400 Error. To my mind, it should not be setting the param at all. I can see how to resolve that - any issues with me adding that to the PR? |
||
meraki_webhook: | ||
auth_key: '{{auth_key}}' | ||
state: query | ||
org_name: '{{test_org_name}}' | ||
net_name: '{{test_net_name}}' | ||
register: query_none | ||
|
||
- debug: | ||
var: query_none | ||
|
||
- assert: | ||
that: | ||
- query_none is not changed | ||
- query_none.data[0] is not defined | ||
|
||
- name: Create webhook with check mode | ||
meraki_webhook: | ||
auth_key: '{{auth_key}}' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a while loop instead of a for loop here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Your comment has made me re-look at this. There is still an issue here so it's not ready for merge.
So that is where i started - I've just tried this again to check - and I think i've been miss-interpreted an error i saw..
with ...
... I get the "Query one webhook" test failing with
TypeError: 'str' object does not support item assignment
. I took that to be an issue with the indirect assignment afforded by the for loop variable and so used a while loop instead with direct assignment.I've miss-understood the meraki.result behaviour - assuming data is always a list - be it empty or with multiple entries. With a query naming a web hook, I'm guessing now data is a dict, not a single entry list pointing to a dict.
I'll look at this again.