diff options
| author | Jeff Lane <jeffrey.lane@canonical.com> | 2014-09-11 21:39:17 +0000 |
|---|---|---|
| committer | Daniel Manrique <> | 2014-09-11 21:39:17 +0000 |
| commit | ad08a8e74a8464c5b612607a785c51c63d2e7fbb (patch) | |
| tree | 40994ddb7e4ba723a8b15033b3dd6e9766d81fcb | |
| parent | a1f1c30f6fde650dc7fc32a2dc06cabd52e6b78b (diff) | |
| parent | ed2223842efc68329ba7a3df9ff11a2a020346b5 (diff) | |
"automatic merge by tarmac [r=roadmr][bug=1367927][author=bladernr]"
| -rwxr-xr-x | bin/disk_smart | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/disk_smart b/bin/disk_smart index 3545700..c7f58df 100755 --- a/bin/disk_smart +++ b/bin/disk_smart @@ -125,6 +125,7 @@ def get_smart_entries(disk, type='selftest'): # Get lengths from header line = stdout.readline().decode() if not line.startswith('Num'): + entries.append('No entries found in log yet') return entries columns = ['number', 'description', 'status', 'remaining', 'lifetime', 'lba'] @@ -215,13 +216,16 @@ def main(): time.sleep(args.sleep) current_entries = get_smart_entries(disk) - logging.debug('%s %s %s %s' % (current_entries[0]['number'], - current_entries[0]['description'], - current_entries[0]['status'], - current_entries[0]['remaining'])) - if current_entries != previous_entries \ - and current_entries[0]["status"] != 'Self-test routine in progress': - break + if isinstance(current_entries[0], str): + logging.debug(current_entries[0]) + else: + logging.debug('%s %s %s %s' % (current_entries[0]['number'], + current_entries[0]['description'], + current_entries[0]['status'], + current_entries[0]['remaining'])) + if current_entries != previous_entries \ + and current_entries[0]["status"] != 'Self-test routine in progress': + break if args.timeout is not None: if args.timeout <= 0: |
