diff --git a/changelogs/fragments/fix_calling_deprecate_with_correct_arguments.yaml b/changelogs/fragments/fix_calling_deprecate_with_correct_arguments.yaml new file mode 100644 index 00000000000..038c12a780f --- /dev/null +++ b/changelogs/fragments/fix_calling_deprecate_with_correct_arguments.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 d62a32e792a..449f60dff1b 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -2327,6 +2327,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: