]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
vminfo adding support for Solaris
authorMladen Uzunov <mladen.uzunov@digitaspixelpark.com>
Thu, 9 Jun 2022 07:43:03 +0000 (10:43 +0300)
committerMladen Uzunov <mladen.uzunov@digitaspixelpark.com>
Thu, 9 Jun 2022 07:43:03 +0000 (10:43 +0300)
.eggs/README.txt [new file with mode: 0644]
bin/vminfo [changed mode: 0644->0755]

diff --git a/.eggs/README.txt b/.eggs/README.txt
new file mode 100644 (file)
index 0000000..5d01668
--- /dev/null
@@ -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.
+
old mode 100644 (file)
new mode 100755 (executable)
index 3cdfe3b..4e64f29
@@ -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()]