From ac796121e20e1ac079644386d95a463784de436a Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 27 Oct 2020 17:03:04 +0100 Subject: [PATCH] pmb.flasher.run: proper check for None (MR 1986) Change the 'not value' condition raising the '...value for this variable is None!' error to 'value is None' so it doesn't raise when the value is something else that evaluates to boolean False, like an empty string. Remove the special treatment for $KERNEL_CMDLINE here by making it default to empty string. --- pmb/flasher/run.py | 2 +- pmb/flasher/variables.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pmb/flasher/run.py b/pmb/flasher/run.py index a8d758ee..a7cce7e8 100644 --- a/pmb/flasher/run.py +++ b/pmb/flasher/run.py @@ -48,7 +48,7 @@ def run(args, action, flavor=None): for key, value in vars.items(): for i in range(len(command)): if key in command[i]: - if not value and key != "$KERNEL_CMDLINE": + if value is None: raise RuntimeError("Variable " + key + " found in" " action " + action + " for method " + method + "," " but the value for this variable is None! Is that" diff --git a/pmb/flasher/variables.py b/pmb/flasher/variables.py index a63db0cf..eb36f91a 100644 --- a/pmb/flasher/variables.py +++ b/pmb/flasher/variables.py @@ -3,7 +3,7 @@ def variables(args, flavor, method): - _cmdline = args.deviceinfo["kernel_cmdline"] + _cmdline = args.deviceinfo["kernel_cmdline"] or "" if "cmdline" in args and args.cmdline: _cmdline = args.cmdline