pmb/flasher: Fix regression with exporting odin images (#1529)

This makes the flasher work when no flash_method attribute exists on
the args variable, which happens when it is invoked through the
pmbootstrap export --odin command. This is a regression introduced
in b29cc877a7

This fixes #1527
This commit is contained in:
Martijn Braam 2018-06-01 20:19:12 +02:00 committed by Oliver Smith
parent 08951548f6
commit 7ac28f9602
1 changed files with 5 additions and 1 deletions

View File

@ -23,7 +23,11 @@ import pmb.helpers.mount
def init(args):
# Validate method
method = args.flash_method or args.deviceinfo["flash_method"]
if hasattr(args, 'flash_method'):
method = args.flash_method or args.deviceinfo["flash_method"]
else:
method = args.deviceinfo["flash_method"]
if method not in pmb.config.flashers:
raise RuntimeError("Flash method " + method + " is not supported by the"
" current configuration. However, adding a new flash method is "