From aa1b850c6f4a4a7e9f997c0376b120cdf6458b19 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Thu, 21 May 2015 00:04:10 +0200 Subject: providers:checkbox: make "recovery_info file" capable of handling binary Signed-off-by: Zygmunt Krynicki --- bin/recovery_info | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'bin') diff --git a/bin/recovery_info b/bin/recovery_info index 69bc64b..17dc46d 100755 --- a/bin/recovery_info +++ b/bin/recovery_info @@ -174,17 +174,9 @@ class RecoveryFile(Command): The return code of the command. Guacamole translates ``None`` to a successful exit status (return code zero). """ - if ctx.args.file is None: - return 1 - with MountedPartition(ctx.recovery_partition) as mntdir: - fname = "{}/{}".format(mntdir, ctx.args.file) - try: - with open(fname, 'rt', encoding='UTF-8') as f: - print(f.read()) - except Exception as e: - sys.stderr.write( - "File({}) is not found, {}\n".format(ctx.args.file, e.msg)) - return 1 + with MountedPartition(ctx.recovery_partition) as mnt: + return subprocess.call([ + 'cat', '--', os.path.join(mnt, ctx.args.file)]) class RecoveryCheckType(Command): -- cgit v1.2.3