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 <ius...@google.com> --- As said, this needs to go before at least patch “Improve Objects.hs definitions” lib/constants.py | 4 ++-- lib/objects.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/constants.py b/lib/constants.py index af3df19..5187c99 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -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, } diff --git a/lib/objects.py b/lib/objects.py index 74526d3..a852593 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -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) -- 1.7.7.3