From: Mladen Uzunov Date: Thu, 9 Jun 2022 07:43:03 +0000 (+0300) Subject: vminfo adding support for Solaris X-Git-Tag: 1.6.1~1^2~2 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=b94dc11908e1ebe9dedd227ef90b70f87f3654aa;p=pixelpark%2Fcreate-terraform.git vminfo adding support for Solaris --- diff --git a/.eggs/README.txt b/.eggs/README.txt new file mode 100644 index 0000000..5d01668 --- /dev/null +++ b/.eggs/README.txt @@ -0,0 +1,6 @@ +This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins. + +This directory caches those eggs to prevent repeated downloads. + +However, it is safe to delete this directory. + diff --git a/bin/vminfo b/bin/vminfo old mode 100644 new mode 100755 index 3cdfe3b..4e64f29 --- a/bin/vminfo +++ b/bin/vminfo @@ -44,9 +44,14 @@ class FactGetter: return data def generalInfo(self): + try: + osInfo = ["OS", self.data["os"]["value"]["distro"]["description"]] + except KeyError: + osInfo = ["OS", f'{self.data["os"]["value"]["name"]} {self.data["os"]["value"]["release"]["major"]}'] # Catching Solaris + data = [["Customer", self.data["customer"]["value"]], ["FQDN", self.data["fqdn"]["value"]], - ["OS", self.data["os"]["value"]["distro"]["description"]], + osInfo, ["Purpose", self.data["pp_purpose"]["value"]], ["Tier", self.data["tier"]["value"]], ["R10k Env", self.data["r10k_environment"]["value"]]] @@ -67,8 +72,12 @@ class FactGetter: def partitionInfo(self): partuuid = re.compile(r"^[\d\w]{8}\-[\d\w]{2}$") self.simpleTabulate([[colored("Partitions:", "green")]], "orgtbl") - self.complexTabulate(self.data["partitions"], additionalSpot={"size": 5, "location": 2}, + try: + self.complexTabulate(self.data["partitions"], additionalSpot={"size": 5, "location": 2}, excludeHeader="partuuid", excludeValue=partuuid) + except KeyError: + print(colored(" [Warning] This host is probably Solaris, therefore partitions are not available in PuppetDB facts.", "red")) + def networkInfo(self): data = [[interface, ','.join(ip)] for interface, ip in self.data["pp_ip_cidr"]["value"].items()]