Merge branch 'stable-2.9' into master
[ganeti-local] / lib / utils / __init__.py
index 8ca7a88..96655a0 100644 (file)
@@ -98,6 +98,10 @@ def ForceDictType(target, key_types, allowed_values=None):
 
     if ktype in (constants.VTYPE_STRING, constants.VTYPE_MAYBE_STRING):
       if target[key] is None and ktype == constants.VTYPE_MAYBE_STRING:
+        msg = "'None' is not a valid Maybe value. Use 'VALUE_HS_NOTHING'"
+        logging.warning(msg)
+      elif (target[key] == constants.VALUE_HS_NOTHING
+            and ktype == constants.VTYPE_MAYBE_STRING):
         pass
       elif not isinstance(target[key], basestring):
         if isinstance(target[key], bool) and not target[key]: