diff --git a/changelogs/fragments/44726-correct_deprecate_call.yaml b/changelogs/fragments/44726-correct_deprecate_call.yaml new file mode 100644 index 00000000000..038c12a780f --- /dev/null +++ b/changelogs/fragments/44726-correct_deprecate_call.yaml @@ -0,0 +1,2 @@ +bugfixes: + - Fix calling deprecate with correct arguments (https://github.com/ansible/ansible/pull/46062). diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index c0398df4ef1..a3e3916e717 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -2352,6 +2352,8 @@ class AnsibleModule(object): for d in kwargs['deprecations']: if isinstance(d, SEQUENCETYPE) and len(d) == 2: self.deprecate(d[0], version=d[1]) + elif isinstance(d, Mapping): + self.deprecate(d['msg'], version=d.get('version', None)) else: self.deprecate(d) else: