Fix error detection in SW Diags

This commit is contained in:
2Shirt 2018-08-21 12:14:17 -07:00
parent c25a46b49f
commit 3875d4b2bd
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -16,7 +16,6 @@ os.system('title {}: System Diagnostics Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\System Diagnostics.log'.format(
**global_vars)
D7_MODE = 'd7mode' in sys.argv
ERRORS = 0
# Static Variables
BLEACH_BIT_CLEANERS = {
@ -68,13 +67,15 @@ BLEACH_BIT_CLEANERS = {
def check_result(result, other_results):
"""Check result for warnings and errors."""
result_ok = True
if not result['CS']:
for warning in other_results.get('Warning', {}).keys():
if warning in str(result['Error']):
# Ignore warnings and repair statements
return
return True
# Error is not a warning
ERRORS += 1
result_ok = False
return result_ok
if __name__ == '__main__':
try:
@ -82,6 +83,7 @@ if __name__ == '__main__':
clear_screen()
print_info('{}: System Diagnostics Tool\n'.format(KIT_NAME_FULL))
ticket_number = get_ticket_number()
system_ok = True
other_results = {
'Error': {
'CalledProcessError': 'Unknown Error',
@ -120,19 +122,18 @@ if __name__ == '__main__':
result = try_and_print(
message='CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']),
function=run_chkdsk, other_results=other_results)
check_result(result, other_results)
system_ok &= check_result(result, other_results)
result = try_and_print(message='SFC scan...',
function=run_sfc_scan, other_results=other_results)
check_result(result, other_results)
system_ok &= check_result(result, other_results)
if D7_MODE:
result = try_and_print(message='DISM RestoreHealth...',
function=run_dism, other_results=other_results, repair=True)
check_result(result, other_results)
system_ok &= check_result(result, other_results)
else:
try_and_print(message='DISM CheckHealth...',
function=run_dism, other_results=other_results, repair=False)
if D7_MODE:
# Archive all browsers for all users
archive_all_users()