-
Notifications
You must be signed in to change notification settings - Fork 47
add hook to handle incompatibilities between ansible 2.7 and ansible 2.8 #47
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
add hook to handle incompatibilities between ansible 2.7 and ansible 2.8 #47
Conversation
dabcoder
left a comment
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.
Thanks for taking care of this, much appreciated. Left a quick note.
datadog_callback.py
Outdated
| import logging | ||
| import os | ||
| import time | ||
| from packaging import version |
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 resulted in having the callback ignored if packaging is not installed (with pip) when I tested this.
Do you think we should include it in the list of requirements then (with datadogpy and pyyaml)?
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.
Yeah, it should be there. Just pushed a commit to put it in the README.
hush-hush
left a comment
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.
Hi @rsdcobalt, thanks for the PR !
I added a few comments, tell me what you think.
datadog_callback.py
Outdated
| from ansible.plugins.callback import CallbackBase | ||
| from __main__ import cli | ||
|
|
||
| ANSIBLE_NEW = False |
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.
Could you rename this to ANSIBLE_ABOVE_28 or something similar as it will not always be the "new" version ?
datadog_callback.py
Outdated
| self._playbook_name, _ = os.path.splitext( | ||
| os.path.basename(playbook_file_name)) | ||
| if isinstance(inventory, list): | ||
| if isinstance(inventory, list) or isinstance(inventory, tuple): |
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 could be on condition: if isinstance(inventory, (list, tuple)):
datadog_callback.py
Outdated
| import logging | ||
| import os | ||
| import time | ||
| from packaging import version |
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.
Could you move this line within the try/catch line 9 and update the error message line 32 ?
|
@hush-hush yeah, those make sense. I just committed the changes. |
|
Thanks a lot for this PR @rsdcobalt, merging today ! |
There have been some changes with ansible 2.8 that aren't compatible with 2.7. I've added a check to handle those differences.