|
|
@ -376,28 +376,46 @@ class Facts(object):
|
|
|
|
|
|
|
|
|
|
|
|
def get_lsb_facts(self):
|
|
|
|
def get_lsb_facts(self):
|
|
|
|
lsb_path = module.get_bin_path('lsb_release')
|
|
|
|
lsb_path = module.get_bin_path('lsb_release')
|
|
|
|
if lsb_path is None:
|
|
|
|
if lsb_path:
|
|
|
|
return self.facts
|
|
|
|
rc, out, err = module.run_command([lsb_path, "-a"])
|
|
|
|
rc, out, err = module.run_command([lsb_path, "-a"])
|
|
|
|
if rc == 0:
|
|
|
|
if rc == 0:
|
|
|
|
self.facts['lsb'] = {}
|
|
|
|
|
|
|
|
for line in out.split('\n'):
|
|
|
|
|
|
|
|
if len(line) < 1:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
value = line.split(':', 1)[1].strip()
|
|
|
|
|
|
|
|
if 'LSB Version:' in line:
|
|
|
|
|
|
|
|
self.facts['lsb']['release'] = value
|
|
|
|
|
|
|
|
elif 'Distributor ID:' in line:
|
|
|
|
|
|
|
|
self.facts['lsb']['id'] = value
|
|
|
|
|
|
|
|
elif 'Description:' in line:
|
|
|
|
|
|
|
|
self.facts['lsb']['description'] = value
|
|
|
|
|
|
|
|
elif 'Release:' in line:
|
|
|
|
|
|
|
|
self.facts['lsb']['release'] = value
|
|
|
|
|
|
|
|
elif 'Codename:' in line:
|
|
|
|
|
|
|
|
self.facts['lsb']['codename'] = value
|
|
|
|
|
|
|
|
if 'lsb' in self.facts and 'release' in self.facts['lsb']:
|
|
|
|
|
|
|
|
self.facts['lsb']['major_release'] = self.facts['lsb']['release'].split('.')[0]
|
|
|
|
|
|
|
|
elif lsb_path is None and os.path.exists('/etc/lsb-release'):
|
|
|
|
self.facts['lsb'] = {}
|
|
|
|
self.facts['lsb'] = {}
|
|
|
|
for line in out.split('\n'):
|
|
|
|
with open('/etc/lsb-release', 'r') as f:
|
|
|
|
if len(line) < 1:
|
|
|
|
for line in f.readlines():
|
|
|
|
continue
|
|
|
|
value = line.split('=',1)[1].strip()
|
|
|
|
value = line.split(':', 1)[1].strip()
|
|
|
|
if 'DISTRIB_ID' in line:
|
|
|
|
if 'LSB Version:' in line:
|
|
|
|
self.facts['lsb']['id'] = value
|
|
|
|
self.facts['lsb']['release'] = value
|
|
|
|
elif 'DISTRIB_RELEASE' in line:
|
|
|
|
elif 'Distributor ID:' in line:
|
|
|
|
self.facts['lsb']['release'] = value
|
|
|
|
self.facts['lsb']['id'] = value
|
|
|
|
elif 'DISTRIB_DESCRIPTION' in line:
|
|
|
|
elif 'Description:' in line:
|
|
|
|
self.facts['lsb']['description'] = value
|
|
|
|
self.facts['lsb']['description'] = value
|
|
|
|
elif 'DISTRIB_CODENAME' in line:
|
|
|
|
elif 'Release:' in line:
|
|
|
|
self.facts['lsb']['codename'] = value
|
|
|
|
self.facts['lsb']['release'] = value
|
|
|
|
else:
|
|
|
|
elif 'Codename:' in line:
|
|
|
|
return self.facts
|
|
|
|
self.facts['lsb']['codename'] = value
|
|
|
|
|
|
|
|
if 'lsb' in self.facts and 'release' in self.facts['lsb']:
|
|
|
|
if 'lsb' in self.facts and 'release' in self.facts['lsb']:
|
|
|
|
self.facts['lsb']['major_release'] = self.facts['lsb']['release'].split('.')[0]
|
|
|
|
self.facts['lsb']['major_release'] = self.facts['lsb']['release'].split('.')[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_selinux_facts(self):
|
|
|
|
def get_selinux_facts(self):
|
|
|
|
if not HAVE_SELINUX:
|
|
|
|
if not HAVE_SELINUX:
|
|
|
|
self.facts['selinux'] = False
|
|
|
|
self.facts['selinux'] = False
|
|
|
|