瀏覽代碼

Add explicit type check for OSMorphing version util.

Nashwan Azhari 6 年之前
父節點
當前提交
91935f2388
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      coriolis/osmorphing/base.py

+ 5 - 0
coriolis/osmorphing/base.py

@@ -141,6 +141,11 @@ class BaseLinuxOSMorphingTools(BaseOSMorphingTools):
         if not version:
             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]+)?)"
         match = re.match(float_regex, version)
         if not match: