Updated to use new hw_diags.py

This commit is contained in:
2Shirt 2018-12-18 16:38:40 -07:00
parent fad65b8df6
commit ad9662c120
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -10,24 +10,28 @@ import time
os.chdir(os.path.dirname(os.path.realpath(__file__))) os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd()) sys.path.append(os.getcwd())
from functions.hw_diags import * from functions.hw_diags import *
#init_global_vars() init_global_vars()
if __name__ == '__main__': if __name__ == '__main__':
try: try:
# Prep # Prep
clear_screen() clear_screen()
dev_path = sys.argv[1] state = State()
devs = scan_disks(True, dev_path) state.init()
# Warn if SMART unavailable # Find disk
if dev_path not in devs: disk = None
print_error('SMART data not available') for d in state.disks:
exit_script() if d.path == sys.argv[1]:
disk = d
# Initial screen # Show details
dev = devs[dev_path]
clear_screen() clear_screen()
show_disk_details(dev, only_attributes=True) if disk:
for line in disk.generate_attribute_report(timestamp=True):
print(line)
else:
print_error('Disk "{}" not found'.format(sys.argv[1]))
# Done # Done
exit_script() exit_script()
@ -36,4 +40,4 @@ if __name__ == '__main__':
except: except:
major_exception() major_exception()
# vim: sts=4 sw=4 ts=4 # vim: sts=2 sw=2 ts=2