def diskInfo(self):
serialNum = re.compile(r'^\d{20}$')
self.simpleTabulate([[colored("Disks:", "green")]], "orgtbl")
- self.complexTabulate(self.data["disks"], excludeValue=serialNum, excludeHeader="serial")
+ self.complexTabulate(self.data["disks"], excludeValue=serialNum, excludeHeader="serial", zeroIndex="Name")
def partitionInfo(self):
partuuid = re.compile(r"^[\d\w]{8}\-[\d\w]{2}$")
else:
print(tabulate(data, tablefmt=self.tableFormat))
- def complexTabulate(self, data, excludeValue=None, excludeHeader=None, additionalSpot=None):
+ def complexTabulate(self, data, excludeValue=None, excludeHeader=None, additionalSpot=None, zeroIndex=None):
finalData = []
for items in data["value"].items():
- if excludeValue is not None:
- values = [x for x in items[1].values() if x !=
- excludeValue and not re.match(excludeValue, str(x))]
+ if excludeValue:
+ values = [x for x in items[1].values() if x != excludeValue and not re.match(excludeValue, str(x))]
+ if zeroIndex:
+ values.insert(0, items[0])
else:
values = [x for x in items[1].values()]
- if excludeHeader is not None:
- headers = [x for x in items[1].keys() if x !=
- excludeHeader and not re.match(excludeHeader, str(x))]
+ if excludeHeader:
+ headers = [x for x in items[1].keys() if x != excludeHeader and not re.match(excludeHeader, str(x))]
else:
headers = [x for x in items[1].keys()]
- if additionalSpot is not None:
+ if additionalSpot:
if len(values) < additionalSpot["size"]:
values.insert(additionalSpot["location"], "--")
finalData.append(values)
+ headers.insert(0, zeroIndex)
print(tabulate(finalData, headers=headers, tablefmt=self.tableFormat))
facter.partitionInfo()
facter.networkInfo()
-
__author__ = 'Mladen Uzunov <mladen.uzunov@pixelpark.com>'
-__copyright__ = '(C) 2022 by Mladen Uzunov, Pixelpark GmbH, Berlin'
\ No newline at end of file
+__copyright__ = '(C) 2022 by Mladen Uzunov, Pixelpark GmbH, Berlin'