Change node parameter oob_program to VTYPE_STRING
authorIustin Pop <iustin@google.com>
Tue, 21 Aug 2012 14:52:07 +0000 (16:52 +0200)
committerIustin Pop <iustin@google.com>
Thu, 23 Aug 2012 08:44:31 +0000 (10:44 +0200)
Since this is an inheritable parameter, having it as a MABYE_STRING
creates only problems (per our derivation rules). We change it to
STRING, with the default "", meaning no program. Note that most of the
code already accepts this as valid for "no program", and some comments
even say that this is the expected value.

We have some other parameters like this, I'll have to investigate
whether they need to be changed too. But right now I need this for the
hconfd changes (it's a prerequisite for them, I forgot to send it in
that patch series).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: RenĂ© Nussbaumer <rn@google.com>

lib/constants.py
lib/objects.py

index af3df19..5187c99 100644 (file)
@@ -974,7 +974,7 @@ ND_OOB_PROGRAM = "oob_program"
 ND_SPINDLE_COUNT = "spindle_count"
 
 NDS_PARAMETER_TYPES = {
-  ND_OOB_PROGRAM: VTYPE_MAYBE_STRING,
+  ND_OOB_PROGRAM: VTYPE_STRING,
   ND_SPINDLE_COUNT: VTYPE_INT,
   }
 
@@ -1842,7 +1842,7 @@ BEC_DEFAULTS = {
   }
 
 NDC_DEFAULTS = {
-  ND_OOB_PROGRAM: None,
+  ND_OOB_PROGRAM: "",
   ND_SPINDLE_COUNT: 1,
   }
 
index 74526d3..a852593 100644 (file)
@@ -173,6 +173,10 @@ def UpgradeNDParams(ndparams):
   if ndparams is None:
     ndparams = {}
 
+  if (constants.ND_OOB_PROGRAM in ndparams and
+      ndparams[constants.ND_OOB_PROGRAM] is None):
+    # will be reset by the line below
+    del ndparams[constants.ND_OOB_PROGRAM]
   return FillDict(constants.NDC_DEFAULTS, ndparams)