From d373b106e74d984e19cddca1a746e0b0b7e20e93 Mon Sep 17 00:00:00 2001 From: Mika Busch Date: Wed, 17 Jun 2020 10:34:44 +0200 Subject: [PATCH] Strip whitespaces when checking if asset tag is banned Sometimes vCenter returns asset tags with a leading whitespace. Instead of adding a second version with a whitespace to the banned tags list we use the strip() method to remove the whitespace bevore checking --- run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index 23601b2..2d38d1a 100644 --- a/run.py +++ b/run.py @@ -204,11 +204,11 @@ def is_banned_asset_tag(text): # Is asset tag in banned list? text = text.lower() banned_tags = [ - "Default string", "NA", "N/A", "None", " none", "Null", "oem", "o.e.m", + "Default string", "NA", "N/A", "None", "Null", "oem", "o.e.m", "to be filled by o.e.m.", "Unknown", " ", "" ] banned_tags = [t.lower() for t in banned_tags] - if text in banned_tags: + if text.strip() in banned_tags: result = True # Does it exceed the max allowed length for NetBox asset tags? elif len(text) > 50: