fixes to virtual facts
fixes #36038
(cherry picked from commit 97b6e99479
)
This commit is contained in:
parent
0c4f6c3f68
commit
dfa3ecaf84
2 changed files with 4 additions and 3 deletions
|
@ -58,6 +58,7 @@ Ansible Changes By Release
|
||||||
https://github.com/ansible/ansible/pull/34130
|
https://github.com/ansible/ansible/pull/34130
|
||||||
* Fix docker_service so a build is not triggered every time
|
* Fix docker_service so a build is not triggered every time
|
||||||
https://github.com/ansible/ansible/issues/36145
|
https://github.com/ansible/ansible/issues/36145
|
||||||
|
* Be more tolerant about spaces when gathering virtual facts (https://github.com/ansible/ansible/pull/36042)
|
||||||
|
|
||||||
|
|
||||||
<a id="2.4.3"></a>
|
<a id="2.4.3"></a>
|
||||||
|
|
|
@ -144,9 +144,9 @@ class LinuxVirtual(Virtual):
|
||||||
|
|
||||||
if os.path.exists('/proc/self/status'):
|
if os.path.exists('/proc/self/status'):
|
||||||
for line in get_file_lines('/proc/self/status'):
|
for line in get_file_lines('/proc/self/status'):
|
||||||
if re.match('^VxID: \d+', line):
|
if re.match(r'^VxID:\s+\d+', line):
|
||||||
virtual_facts['virtualization_type'] = 'linux_vserver'
|
virtual_facts['virtualization_type'] = 'linux_vserver'
|
||||||
if re.match('^VxID: 0', line):
|
if re.match(r'^VxID:\s+0', line):
|
||||||
virtual_facts['virtualization_role'] = 'host'
|
virtual_facts['virtualization_role'] = 'host'
|
||||||
else:
|
else:
|
||||||
virtual_facts['virtualization_role'] = 'guest'
|
virtual_facts['virtualization_role'] = 'guest'
|
||||||
|
@ -200,7 +200,7 @@ class LinuxVirtual(Virtual):
|
||||||
if open(f).read().rstrip() == 'vdsm':
|
if open(f).read().rstrip() == 'vdsm':
|
||||||
virtual_facts['virtualization_type'] = 'RHEV'
|
virtual_facts['virtualization_type'] = 'RHEV'
|
||||||
break
|
break
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
virtual_facts['virtualization_type'] = 'kvm'
|
virtual_facts['virtualization_type'] = 'kvm'
|
||||||
|
|
Loading…
Reference in a new issue