1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Handle unreadable /proc/xen/capabilities

Fixes #1854.
This commit is contained in:
Daniel Hokka Zakrisson 2013-01-10 18:22:01 +01:00
parent b9442b2468
commit 3bc6228b97

View file

@ -713,10 +713,12 @@ class LinuxVirtual(Virtual):
if os.path.exists("/proc/xen"):
self.facts['virtualization_type'] = 'xen'
self.facts['virtualization_role'] = 'guest'
if os.path.exists('/proc/xen/capabilities'):
try:
for line in open('/proc/xen/capabilities'):
if "control_d" in line:
self.facts['virtualization_role'] = 'host'
except IOError:
pass
return
if os.path.exists('/proc/vz'):