mirror of
https://github.com/gryf/boxpy.git
synced 2025-12-19 21:47:59 +01:00
Fail on yaml parse errors
This commit is contained in:
12
box.py
12
box.py
@@ -1066,6 +1066,10 @@ def vmcreate(args, conf=None):
|
|||||||
conf = Config(args)
|
conf = Config(args)
|
||||||
except BoxNotFound:
|
except BoxNotFound:
|
||||||
return 7
|
return 7
|
||||||
|
except yaml.YAMLError:
|
||||||
|
LOG.fatal(f'Cannot read or parse file `{args.config}` as YAML '
|
||||||
|
f'file')
|
||||||
|
return 14
|
||||||
LOG.header('Creating VM: %s', conf.name)
|
LOG.header('Creating VM: %s', conf.name)
|
||||||
|
|
||||||
vbox = VBoxManage(conf.name)
|
vbox = VBoxManage(conf.name)
|
||||||
@@ -1255,6 +1259,10 @@ def vmrebuild(args):
|
|||||||
conf = Config(args, vbox)
|
conf = Config(args, vbox)
|
||||||
except BoxNotFound:
|
except BoxNotFound:
|
||||||
return 8
|
return 8
|
||||||
|
except yaml.YAMLError:
|
||||||
|
LOG.fatal(f'Cannot read or parse file `{args.config}` as YAML '
|
||||||
|
f'file')
|
||||||
|
return 15
|
||||||
|
|
||||||
vbox.poweroff()
|
vbox.poweroff()
|
||||||
|
|
||||||
@@ -1288,6 +1296,10 @@ def connect(args):
|
|||||||
conf = Config(args, vbox)
|
conf = Config(args, vbox)
|
||||||
except BoxNotFound:
|
except BoxNotFound:
|
||||||
return 11
|
return 11
|
||||||
|
except yaml.YAMLError:
|
||||||
|
LOG.fatal(f'Cannot read or parse file `{args.config}` as YAML '
|
||||||
|
f'file.')
|
||||||
|
return 16
|
||||||
|
|
||||||
return Run(['ssh', '-o', 'StrictHostKeyChecking=no',
|
return Run(['ssh', '-o', 'StrictHostKeyChecking=no',
|
||||||
'-o', 'UserKnownHostsFile=/dev/null',
|
'-o', 'UserKnownHostsFile=/dev/null',
|
||||||
|
|||||||
Reference in New Issue
Block a user