From adfbccce496b1f9492c538cfca7dd453ab3781a8 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Thu, 21 May 2015 00:04:10 +0200 Subject: providers:checkbox: simplify and reword recovery_info checktype Signed-off-by: Zygmunt Krynicki --- bin/recovery_info | 24 +++++++++++------------- 1 file 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 -- cgit v1.2.3