summaryrefslogtreecommitdiff
diff options
authorJeff Lane <jeffrey.lane@canonical.com>2015-12-11 17:41:50 -0500
committerJeff Lane <jeffrey.lane@canonical.com>2015-12-11 17:41:50 -0500
commitf1746d2da888dc26e0d242c369020adbec28bca7 (patch)
treede9df0c964014292109c385bd4696857191caa94
parentc54e70843f8f06aaba5988bc865157a5673f57b1 (diff)
After further review, refined the matching a bit so only one regex is needed
-rwxr-xr-xbin/memory_compare9
1 files changed, 3 insertions, 6 deletions
diff --git a/bin/memory_compare b/bin/memory_compare
index ec307fe..c145038 100755
--- a/bin/memory_compare
+++ b/bin/memory_compare
@@ -37,18 +37,15 @@ class LshwJsonResult:
memory_reported = 0
banks_reported = 0
-
+
# jlane LP:1525009
- # some systems ID as "memory" and some as "memory:X"
- id_regex = re.compile('memory:?\d?')
# Discovered the case can change, my x86 systems used "System Memory"
# Failing ARM system used "System memory"
desc_regex = re.compile('System Memory', re.IGNORECASE)
def addHardware(self, hardware):
- if self.id_regex.match(hardware['id']):
- if self.desc_regex.match(hardware.get('description',0)):
- self.memory_reported += int(hardware.get('size', 0))
+ if self.desc_regex.match(str(hardware.get('description',0))):
+ self.memory_reported += int(hardware.get('size', 0))
elif 'bank' in hardware['id']:
self.banks_reported += int(hardware.get('size', 0))