diff options
author | Zygmunt Krynicki <zygmunt.krynicki@canonical.com> | 2015-05-21 00:04:10 +0200 |
---|---|---|
committer | Zygmunt Krynicki <zygmunt.krynicki@canonical.com> | 2015-05-21 00:04:10 +0200 |
commit | adfbccce496b1f9492c538cfca7dd453ab3781a8 (patch) | |
tree | 321ad4087e51d7f04ddb1de37a831936e8ab5d3b | |
parent | 97bec929430d0f72542e428fae9975092cea5008 (diff) |
providers:checkbox: simplify and reword recovery_info checktype
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
-rwxr-xr-x | bin/recovery_info | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/bin/recovery_info b/bin/recovery_info index 9d5c828..1b864a4 100755 --- a/bin/recovery_info +++ b/bin/recovery_info @@ -182,9 +182,15 @@ class RecoveryFile(Command): class RecoveryCheckType(Command): """ - subcommand of RecoveryInfo. + test if the recovery partition is of the given type. - Check the recovery type if not matched return 1 + This command can be used for scripted tests, to see if the recovery + partition on the current system is of a concrete type or not (e.g. + DELL-specific) + + @EPILOG@ + + The exit code is 0 if the recovery partition type matches and 1 otherwise. """ def register_arguments(self, parser): @@ -194,12 +200,8 @@ class RecoveryCheckType(Command): :param parser: Argument parser (from :mod:`argparse`) specific to this command. """ - parser.add_argument('type', - help="""\ -Check current recovery type, like DELL. -If current recovery type is DELL, return value is 0. -If current recovery type is not DELL, return value is 1. -""") + parser.add_argument( + 'type', help="expected type of the recovery partition") def invoked(self, ctx): """ @@ -214,11 +216,7 @@ If current recovery type is not DELL, return value is 1. The return code of the command. Guacamole translates ``None`` to a successful exit status (return code zero). """ - if ctx.recovery_type != ctx.args.type.upper(): - sys.stderr.write( - "{} and {}".format(ctx.recovery_type, - ctx.args.type.upper())) - sys.stderr.write(ctx.args.type.upper()) + if ctx.recovery_type != ctx.args.type: return 1 |