napalm-automation / napalm-base

Apache License 2.0
32 stars 48 forks source link

Fix napalm validate so identical strings will work #288

Closed ktbyers closed 7 years ago

ktbyers commented 7 years ago

Essence of change is this:

+            m = re.search(src, py23_compat.text_type(dst))
+            if m:
+                return bool(m)
+            else:
+                return src == dst

Basically try re.search first and if that fails, then look for exact string comparison.

I also eliminated an unnecessary 'else' from the code as it was serving no purpose.

dbarrosop commented 7 years ago

LGTM, merging