mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -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:
parent
6f4f8e6e79
commit
1d6608e84f
3 changed files with 156 additions and 80 deletions
|
@ -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']
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue