Nuke _get_item() from callback, deprecated 2.11 (#70233)
Change: - Remove _get_item() alias as it has been deprecated - Update tests - Remove relevant sanity curtailment - Add changelog Test Plan: CI, grep Signed-off-by: Rick Elrod <rick@elrod.me>
This commit is contained in:
parent
88bb76f248
commit
7584e145a9
4 changed files with 2 additions and 24 deletions
changelogs/fragments
lib/ansible/plugins/callback
test
2
changelogs/fragments/deprecation-callback-get_item.yml
Normal file
2
changelogs/fragments/deprecation-callback-get_item.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
removed_features:
|
||||
- Removed `_get_item()` alias from callback plugin base class which had been deprecated in favor of `_get_item_label()`.
|
|
@ -239,13 +239,6 @@ class CallbackBase(AnsiblePlugin):
|
|||
item = result.get('_ansible_item_label', result.get('item'))
|
||||
return item
|
||||
|
||||
def _get_item(self, result):
|
||||
''' here for backwards compat, really should have always been named: _get_item_label'''
|
||||
cback = getattr(self, 'NAME', os.path.basename(__file__))
|
||||
self._display.deprecated("The %s callback plugin should be updated to use the _get_item_label method instead" % cback,
|
||||
version="2.11", collection_name='ansible.builtin')
|
||||
return self._get_item_label(result)
|
||||
|
||||
def _process_items(self, result):
|
||||
# just remove them as now they get handled by individual callbacks
|
||||
del result._result['results']
|
||||
|
|
|
@ -182,7 +182,6 @@ lib/ansible/playbook/helpers.py pylint:blacklisted-name
|
|||
lib/ansible/playbook/role/__init__.py pylint:blacklisted-name
|
||||
lib/ansible/plugins/action/normal.py action-plugin-docs # default action plugin for modules without a dedicated action plugin
|
||||
lib/ansible/plugins/cache/base.py ansible-doc!skip # not a plugin, but a stub for backwards compatibility
|
||||
lib/ansible/plugins/callback/__init__.py pylint:ansible-deprecated-version
|
||||
lib/ansible/plugins/lookup/sequence.py pylint:blacklisted-name
|
||||
lib/ansible/plugins/strategy/__init__.py pylint:ansible-deprecated-version
|
||||
lib/ansible/plugins/strategy/__init__.py pylint:blacklisted-name
|
||||
|
|
|
@ -52,22 +52,6 @@ class TestCallback(unittest.TestCase):
|
|||
|
||||
class TestCallbackResults(unittest.TestCase):
|
||||
|
||||
def test_get_item(self):
|
||||
cb = CallbackBase()
|
||||
results = {'item': 'some_item'}
|
||||
res = cb._get_item(results)
|
||||
self.assertEqual(res, 'some_item')
|
||||
|
||||
def test_get_item_no_log(self):
|
||||
cb = CallbackBase()
|
||||
results = {'item': 'some_item', '_ansible_no_log': True}
|
||||
res = cb._get_item(results)
|
||||
self.assertEqual(res, "(censored due to no_log)")
|
||||
|
||||
results = {'item': 'some_item', '_ansible_no_log': False}
|
||||
res = cb._get_item(results)
|
||||
self.assertEqual(res, "some_item")
|
||||
|
||||
def test_get_item_label(self):
|
||||
cb = CallbackBase()
|
||||
results = {'item': 'some_item'}
|
||||
|
|
Loading…
Add table
Reference in a new issue