mirror of
https://github.com/ansible/ansible-documentation.git
synced 2026-03-26 13:18:58 +07:00
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
This commit is contained in:
committed by
Toshio Kuratomi
parent
6f4f8e6e79
commit
1d6608e84f
@@ -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']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user