From 7a5c436a39b66e197c964656e30733f7d4ace3b2 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 2 Jun 2019 13:08:44 +0100 Subject: [PATCH] issue #590: Ansible test for module_utils.distro use. --- .../lib/modules/custom_python_uses_distro.py | 13 +++++++++++++ .../regression/issue_590__sys_modules_crap.yml | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/ansible/lib/modules/custom_python_uses_distro.py create mode 100644 tests/ansible/regression/issue_590__sys_modules_crap.yml diff --git a/tests/ansible/lib/modules/custom_python_uses_distro.py b/tests/ansible/lib/modules/custom_python_uses_distro.py new file mode 100644 index 00000000..c5ffbb84 --- /dev/null +++ b/tests/ansible/lib/modules/custom_python_uses_distro.py @@ -0,0 +1,13 @@ +#!/usr/bin/python +# issue #590: I am an Ansible new-style Python module that tries to use +# ansible.module_utils.distro. + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils import distro + +def main(): + module = AnsibleModule(argument_spec={}) + module.exit_json(info=distro.info()) + +if __name__ == '__main__': + main() diff --git a/tests/ansible/regression/issue_590__sys_modules_crap.yml b/tests/ansible/regression/issue_590__sys_modules_crap.yml new file mode 100644 index 00000000..83a9a286 --- /dev/null +++ b/tests/ansible/regression/issue_590__sys_modules_crap.yml @@ -0,0 +1,9 @@ + +- hosts: test-targets + tasks: + - custom_python_uses_distro: + register: out + + - assert: + that: + - "'id' in out.info"