diff options
author | George Kraft <george.kraft@calxeda.com> | 2012-07-10 09:28:10 -0500 |
---|---|---|
committer | George Kraft <george.kraft@calxeda.com> | 2012-07-10 09:28:10 -0500 |
commit | b2b2699514a8d47d244507bac5d94579de681223 (patch) | |
tree | 6b6bb62715379561201aaecaad623574283d0c3e | |
parent | 246ba2c4a55dc042c597876fa3fea15930fb3263 (diff) | |
download | cxmanage-b2b2699514a8d47d244507bac5d94579de681223.tar.gz |
cxmanage: Validate config_boot args at start
-rwxr-xr-x | scripts/cxmanage | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/cxmanage b/scripts/cxmanage index f6abaff..4d3e5b6 100755 --- a/scripts/cxmanage +++ b/scripts/cxmanage @@ -185,6 +185,22 @@ def validate_args(args): if args.skip_simg and args.skip_crc32: sys.exit('Invalid argument --skip-crc32 when supplied with --skip-simg') + if args.func == config_boot_command: + if not args.boot_args in ['none', 'status']: + boot_args = args.boot_args.split(",") + for arg in boot_args: + if arg.startswith('disk') and len(arg) > 4: + try: + int(arg[4:]) + except ValueError: + sys.exit('Invalid boot arg: %s' % arg) + elif not arg in ['disk', 'pxe', 'retry', 'reset']: + sys.exit('Invalid boot args: %s' % args.boot_args) + if 'retry' in boot_args: + if len(boot_args) == 1: + sys.exit('Invalid boot args: can\'t retry nothing') + elif 'reset' in boot_args: + sys.exit('Invalid boot args: retry and reset are mutually exclusive') def main(): """Get args and go""" |