diff options
author | Rod Smith <rod.smith@canonical.com> | 2015-10-08 15:09:46 -0400 |
---|---|---|
committer | Rod Smith <rod.smith@canonical.com> | 2015-10-08 15:09:46 -0400 |
commit | a43f05cca7d96f0334e1fa95ec161781fdc92fd5 (patch) | |
tree | 2d7a054be531053ad0144528692b5a71f7bf501a | |
parent | 1060c58037c731f772fc82183a45812ee0126459 (diff) |
disk_smart script: Specify UTF-8 encoding with option to drop characters with encoding errors when checking SMART enablement status.
-rwxr-xr-x | bin/disk_smart | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/disk_smart b/bin/disk_smart index fc5e21f..87b0bb3 100755 --- a/bin/disk_smart +++ b/bin/disk_smart @@ -114,7 +114,8 @@ def is_smart_enabled(disk): command = 'smartctl -i %s' % disk diskinfo_bytes = (Popen(command, stdout=PIPE, shell=True) .communicate()[0]) - diskinfo = diskinfo_bytes.decode().splitlines() + diskinfo = (diskinfo_bytes.decode(encoding='utf-8', errors='ignore') + .splitlines()) logging.debug('SMART Info for disk %s', disk) logging.debug(diskinfo) |