Skip to content

Commit

Permalink
Fix deprecated 'results' for ansible module kafka_info (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryarnyah authored Apr 7, 2022
1 parent e4db6f3 commit a2b5b4b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion library/kafka_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

__metaclass__ = type

from pkg_resources import parse_version

from ansible.module_utils.ansible_release import __version__ as ansible_version

# import module snippets
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
Expand Down Expand Up @@ -87,6 +91,7 @@ def main():
params = module.params
resource = params['resource']
manager = None
results = None

try:
manager = get_manager_from_params(params)
Expand All @@ -106,7 +111,11 @@ def main():
manager.close()
maybe_clean_kafka_ssl_files(params)

module.exit_json(changed=True, results=results)
# Ansible deprecate module 'results' key
if parse_version(ansible_version) < parse_version('2.8.0'):
module.exit_json(changed=True, results=results)
else:
module.exit_json(changed=True, ansible_module_results=results)


if __name__ == '__main__':
Expand Down

0 comments on commit a2b5b4b

Please sign in to comment.