-
Notifications
You must be signed in to change notification settings - Fork 27
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
Jobs list error ; Closes #262 #263
Conversation
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
thank for finding the issue but actually this does not fix the problem cause the key is being accessed anyway. You should write in to safe check it |
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
el.get("playbook_to_execute", []) | ||
if el.get("playbook_to_execute") | ||
else [] |
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.
el.get("playbook_to_execute", []) | |
if el.get("playbook_to_execute") | |
else [] | |
el["playbook_to_execute"] | |
if "playbook_to_execute" in el | |
else [] |
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.
this is the best way to do that
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.
@mlodic, sir this would not check if el["playbook_to_execute"] is iterable or not.
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.
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.
oh good catch. I think that this is an imperfection of the APIs because either you have the key populated or you don't have that key at all. Having the key available and set as null does not make any sense, it is wasted data and causes problems in handling the data, like the one you found. So well, we have to stick with your solution. Thank you
Description
I have corrected the key value error and added a condition to check it the playbook_to_execute field is iterable.
Please include a summary of the change.
Related issues
Please add related issues.
Type of change
Please delete options that are not relevant.
Checklist
Black
gave 0 errors.Flake
gave 0 errors.please follow these rules
Real World Example
Please delete if the PR is for bug fixing.
Otherwise, please provide the resulting raw JSON of a finished analysis (and, if you like, a screenshot of the results). This is to allow the maintainers to understand how the analyzer works.