From 3bdf742d504f87aa6e9a505a98bbea12adf4c5fb Mon Sep 17 00:00:00 2001 From: Chris Gardner Date: Sat, 1 Jun 2013 20:32:28 +0100 Subject: [PATCH 1/2] Add Solaris O/S facts "distribution" and "distribution_*" --- system/setup | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/system/setup b/system/setup index 0315a351dad..3c65b2a02ac 100644 --- a/system/setup +++ b/system/setup @@ -102,7 +102,8 @@ class Facts(object): '/etc/vmware-release': 'VMwareESX', '/etc/openwrt_release': 'OpenWrt', '/etc/system-release': 'OtherLinux', - '/etc/alpine-release': 'Alpine' } + '/etc/alpine-release': 'Alpine', + '/etc/release': 'Solaris' } SELINUX_MODE_DICT = { 1: 'enforcing', 0: 'permissive', -1: 'disabled' } # A list of dicts. If there is a platform with more than one @@ -135,7 +136,7 @@ class Facts(object): return self.facts # Platform - # patform.system() can be Linux, Darwin, Java, or Windows + # platform.system() can be Linux, Darwin, Java, or Windows def get_platform_facts(self): self.facts['system'] = platform.system() self.facts['kernel'] = platform.release() @@ -235,6 +236,15 @@ class Facts(object): data = get_file_content(path) self.facts['distribution'] = 'Alpine' self.facts['distribution_version'] = data + elif name == 'Solaris': + data = get_file_content(path).split('\n')[0] + if 'Oracle Solaris' in data: + data = " ".join(data.split()[1:None]) + self.facts['distribution'] = data.split()[0] + self.facts['distribution_version'] = data.split()[1] + distribution_release = " ".join(data.split()[2:None]) + if distribution_release != 'X86' and distribution_release != 'SPARC': + self.facts['distribution_release'] = distribution_release else: self.facts['distribution'] = name From 28cc0119a1f9cda1fb2e71136f816ffcf6a718cd Mon Sep 17 00:00:00 2001 From: Chris Gardner Date: Mon, 3 Jun 2013 22:33:01 +0100 Subject: [PATCH 2/2] Use first line from /etc/release in "distribution_release" for consistency across Solaris and derivatives. --- system/setup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/setup b/system/setup index 3c65b2a02ac..af442a3b771 100644 --- a/system/setup +++ b/system/setup @@ -238,13 +238,13 @@ class Facts(object): self.facts['distribution_version'] = data elif name == 'Solaris': data = get_file_content(path).split('\n')[0] + ora_prefix = '' if 'Oracle Solaris' in data: - data = " ".join(data.split()[1:None]) + data = data.replace('Oracle ','') + ora_prefix = 'Oracle ' self.facts['distribution'] = data.split()[0] self.facts['distribution_version'] = data.split()[1] - distribution_release = " ".join(data.split()[2:None]) - if distribution_release != 'X86' and distribution_release != 'SPARC': - self.facts['distribution_release'] = distribution_release + self.facts['distribution_release'] = ora_prefix + data else: self.facts['distribution'] = name