Verify that machine-config arg is a file
If machine-config is pointed to a non-existant file, dryrun can kind of unhelpfully hang without much indication that anything is happening.
This commit is contained in:
parent
9f883ff0f7
commit
ada889328d
|
@ -44,6 +44,7 @@ def parse_options(argv):
|
||||||
help='Run the installer in ascii mode.')
|
help='Run the installer in ascii mode.')
|
||||||
parser.add_argument('--machine-config', metavar='CONFIG',
|
parser.add_argument('--machine-config', metavar='CONFIG',
|
||||||
dest='machine_config',
|
dest='machine_config',
|
||||||
|
type=argparse.FileType(),
|
||||||
help="Don't Probe. Use probe data file")
|
help="Don't Probe. Use probe data file")
|
||||||
parser.add_argument('--screens', action='append', dest='screens',
|
parser.add_argument('--screens', action='append', dest='screens',
|
||||||
default=[])
|
default=[])
|
||||||
|
|
|
@ -36,6 +36,7 @@ def make_server_args_parser():
|
||||||
parser.add_argument('--socket')
|
parser.add_argument('--socket')
|
||||||
parser.add_argument('--machine-config', metavar='CONFIG',
|
parser.add_argument('--machine-config', metavar='CONFIG',
|
||||||
dest='machine_config',
|
dest='machine_config',
|
||||||
|
type=argparse.FileType(),
|
||||||
help="Don't Probe. Use probe data file")
|
help="Don't Probe. Use probe data file")
|
||||||
parser.add_argument('--bootloader',
|
parser.add_argument('--bootloader',
|
||||||
choices=['none', 'bios', 'prep', 'uefi'],
|
choices=['none', 'bios', 'prep', 'uefi'],
|
||||||
|
|
|
@ -29,8 +29,7 @@ class Prober():
|
||||||
def __init__(self, machine_config, debug_flags):
|
def __init__(self, machine_config, debug_flags):
|
||||||
self.saved_config = None
|
self.saved_config = None
|
||||||
if machine_config:
|
if machine_config:
|
||||||
with open(machine_config) as mc:
|
self.saved_config = yaml.safe_load(machine_config)
|
||||||
self.saved_config = yaml.safe_load(mc)
|
|
||||||
self.debug_flags = debug_flags
|
self.debug_flags = debug_flags
|
||||||
log.debug('Prober() init finished, data:{}'.format(self.saved_config))
|
log.debug('Prober() init finished, data:{}'.format(self.saved_config))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue