Skip to content

Commit a1f2ec2

Browse files
committed
issue #590: fix test for <2.8 Ansibles.
1 parent 90105e2 commit a1f2ec2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/ansible/lib/modules/custom_python_uses_distro.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22
# issue #590: I am an Ansible new-style Python module that tries to use
33
# ansible.module_utils.distro.
44

5+
import ansible
56
from ansible.module_utils.basic import AnsibleModule
6-
from ansible.module_utils import distro
7+
8+
if ansible.__version__ > '2.8':
9+
from ansible.module_utils import distro
10+
else:
11+
distro = None
712

813
def main():
914
module = AnsibleModule(argument_spec={})
10-
module.exit_json(info=distro.info())
15+
if ansible.__version__ > '2.8':
16+
module.exit_json(info=distro.info())
17+
else:
18+
module.exit_json(info={'id': None})
1119

1220
if __name__ == '__main__':
1321
main()

0 commit comments

Comments
 (0)