summaryrefslogtreecommitdiffstats
path: root/hacking
diff options
context:
space:
mode:
authorRobin Roth <robin-roth@online.de>2016-04-29 22:18:50 +0200
committerToshio Kuratomi <a.badger@gmail.com>2016-04-29 22:18:50 +0200
commit1d6608e84f145907667c6c264949332b6aa33356 (patch)
treec3445822b6fb678c5550ea3c5f24daf791ed1412 /hacking
parentfix typo (diff)
downloadansible-1d6608e84f145907667c6c264949332b6aa33356.tar.xz
ansible-1d6608e84f145907667c6c264949332b6aa33356.zip
Dist version fix for Red Hat and more tests (#15663)
* add tests for centos6, rhel6 and rhel7 * gen_distribution_version_testcase with python2.6 * remove unused imports * fix redhat/vmware/... parsing * add centos7 test case
Diffstat (limited to 'hacking')
-rwxr-xr-xhacking/tests/gen_distribution_version_testcase.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/hacking/tests/gen_distribution_version_testcase.py b/hacking/tests/gen_distribution_version_testcase.py
index d7355040cd..f221100b71 100755
--- a/hacking/tests/gen_distribution_version_testcase.py
+++ b/hacking/tests/gen_distribution_version_testcase.py
@@ -46,11 +46,14 @@ dist = platform.dist()
facts = ['distribution', 'distribution_version', 'distribution_release', 'distribution_major_version']
-ansible_out = subprocess.check_output(['ansible', 'localhost', '-m', 'setup'])
+ansible_out = subprocess.Popen(['ansible', 'localhost', '-m', 'setup'], stdout=subprocess.PIPE).communicate()[0]
parsed = json.loads(ansible_out[ansible_out.index('{'):])
ansible_facts = {}
for fact in facts:
- ansible_facts[fact] = parsed['ansible_facts']['ansible_'+fact]
+ try:
+ ansible_facts[fact] = parsed['ansible_facts']['ansible_'+fact]
+ except:
+ ansible_facts[fact] = "N/A"
nicename = ansible_facts['distribution'] + ' ' + ansible_facts['distribution_version']