Selaa lähdekoodia

Add explicit type check for OSMorphing version util.

Nashwan Azhari 6 vuotta sitten
vanhempi
sitoutus
91935f2388
1 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  1. 5 0
      coriolis/osmorphing/base.py

+ 5 - 0
coriolis/osmorphing/base.py

@@ -141,6 +141,11 @@ class BaseLinuxOSMorphingTools(BaseOSMorphingTools):
         if not version:
         if not version:
             return False
             return False
 
 
+        if type(version) is not str:
+            raise ValueError(
+                "Non-string version provided: %s (type %s)" % (
+                    version, type(version)))
+
         float_regex = "([0-9]+(\\.[0-9]+)?)"
         float_regex = "([0-9]+(\\.[0-9]+)?)"
         match = re.match(float_regex, version)
         match = re.match(float_regex, version)
         if not match:
         if not match: