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.
This commit is contained in:
Oliver Smith 2020-10-27 17:03:04 +01:00 committed by Alexey Min
parent fae2379d6b
commit ac796121e2
No known key found for this signature in database
GPG Key ID: EBF5ECFFFEE34DED
2 changed files with 2 additions and 2 deletions

View File

@ -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"

View File

@ -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