-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
fix minor issues with debug and item labels #41331
Conversation
return item | ||
|
||
def _get_item(self, result): | ||
''' here for backwards compat, really should have always been named: ''' | ||
self._display.deprecated("This callback should be updated to use the _get_item_label method instead", version="2.11") |
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.
Can we do better than "This callback"?
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.
only for v2 ones, older ones are not guaranteed to have name
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.
We could fall back to __file__
or something in that case at minimum. Could be useful to include that regardless.
for key in list(result.keys()): | ||
if key.startswith('_'): | ||
continue # but leave 'control keys' in | ||
if key != 'msg': |
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.
These 2 if
statements could probably be combined. To pop
when if it doesn't start with _
or not equal to msg
.
- no more `item=None`, we always have a label now - debug should only show expected information, either msg= or the var in var= - also fixed method name, deprecated misleading _get_item
return item | ||
|
||
def _get_item(self, result): | ||
''' here for backwards compat, really should have always been named: ''' |
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.
It seems like this comment is missing a _get_item_label
at the end, unless that colon implies that it should be inferred from reading the code below it.
label = self._task.loop_control.label | ||
|
||
# ensure we always have a label | ||
if not label: |
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 should probably be if label is None:
, as the above would be triggered by doing label: false
(even though it's somewhat non-sensical).
I'm not entirely sure what this is actually fixing, but it looks good in general |
* fix minor issues with debug and item labels - no more `item=None`, we always have a label now - debug should only show expected information, either msg= or the var in var= - also fixed method name, deprecated misleading _get_item (cherry picked from commit 27c43da)
* fix minor issues with debug and item labels - no more `item=None`, we always have a label now - debug should only show expected information, either msg= or the var in var= - also fixed method name, deprecated misleading _get_item (cherry picked from commit 27c43da)
* fix minor issues with debug and item labels - no more `item=None`, we always have a label now - debug should only show expected information, either msg= or the var in var= - also fixed method name, deprecated misleading _get_item (cherry picked from commit 27c43da)
* fix minor issues with debug and item labels - no more `item=None`, we always have a label now - debug should only show expected information, either msg= or the var in var= - also fixed method name, deprecated misleading _get_item
* fix minor issues with debug and item labels - no more `item=None`, we always have a label now - debug should only show expected information, either msg= or the var in var= - also fixed method name, deprecated misleading _get_item (cherry picked from commit 27c43da)
* fix minor issues with debug and item labels - no more `item=None`, we always have a label now - debug should only show expected information, either msg= or the var in var= - also fixed method name, deprecated misleading _get_item (cherry picked from commit 27c43da)
SUMMARY
item=None
, we always have a label nowfixes #41571
ISSUE TYPE
COMPONENT NAME
callbacks
ANSIBLE VERSION