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 | aa1b850c6f4a4a7e9f997c0376b120cdf6458b19 (patch) | |
tree | 03724cbdb9afa76343e19897aac017bacdd2d4fc /bin | |
parent | bf14ec0951850558722dbda6c79f3d4c4112f901 (diff) |
providers:checkbox: make "recovery_info file" capable of handling binary
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/recovery_info | 14 |
1 files changed, 3 insertions, 11 deletions
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): |