diff options
author | Robin Roth <robin-roth@online.de> | 2016-04-29 22:18:50 +0200 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-04-29 22:18:50 +0200 |
commit | 1d6608e84f145907667c6c264949332b6aa33356 (patch) | |
tree | c3445822b6fb678c5550ea3c5f24daf791ed1412 /hacking | |
parent | fix typo (diff) | |
download | ansible-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-x | hacking/tests/gen_distribution_version_testcase.py | 7 |
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'] |