summaryrefslogtreecommitdiffstats
path: root/hacking/tests
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2018-12-11 02:04:14 +0100
committerToshio Kuratomi <a.badger@gmail.com>2018-12-17 20:01:01 +0100
commit61b1daa65f2e1978fac127aa11f7b0831d4ff243 (patch)
treea5a705755df26e6818c26046d988965377767ebf /hacking/tests
parentSkip sanity tests that don't apply to bundled code (diff)
downloadansible-61b1daa65f2e1978fac127aa11f7b0831d4ff243.tar.xz
ansible-61b1daa65f2e1978fac127aa11f7b0831d4ff243.zip
Port from plaform.dist to ansible.module_utils.distro.linux_distribution
ci_complete
Diffstat (limited to 'hacking/tests')
-rwxr-xr-xhacking/tests/gen_distribution_version_testcase.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/hacking/tests/gen_distribution_version_testcase.py b/hacking/tests/gen_distribution_version_testcase.py
index 6bc52c4e41..6d09c77af0 100755
--- a/hacking/tests/gen_distribution_version_testcase.py
+++ b/hacking/tests/gen_distribution_version_testcase.py
@@ -3,17 +3,21 @@
"""
This script generated test_cases for test_distribution_version.py.
-To do so it outputs the relevant files from /etc/*release, the output of platform.dist() and the current ansible_facts regarding the distribution version.
+To do so it outputs the relevant files from /etc/*release, the output of distro.linux_distribution()
+and the current ansible_facts regarding the distribution version.
This assumes a working ansible version in the path.
"""
-import platform
+
import os.path
import subprocess
import json
import sys
+from ansible.module_utils import distro
+
+
filelist = [
'/etc/oracle-release',
'/etc/slackware-version',
@@ -44,8 +48,7 @@ for f in filelist:
with open(f) as fh:
fcont[f] = fh.read()
-dist = platform.dist()
-
+dist = distro.linux_distribution(full_distribution_name=False)
facts = ['distribution', 'distribution_version', 'distribution_release', 'distribution_major_version', 'os_family']