Fix error detection in SW Diags
This commit is contained in:
parent
c25a46b49f
commit
3875d4b2bd
1 changed files with 18 additions and 17 deletions
|
|
@ -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['LogFile'] = r'{LogDir}\System Diagnostics.log'.format(
|
||||||
**global_vars)
|
**global_vars)
|
||||||
D7_MODE = 'd7mode' in sys.argv
|
D7_MODE = 'd7mode' in sys.argv
|
||||||
ERRORS = 0
|
|
||||||
|
|
||||||
# Static Variables
|
# Static Variables
|
||||||
BLEACH_BIT_CLEANERS = {
|
BLEACH_BIT_CLEANERS = {
|
||||||
|
|
@ -68,13 +67,15 @@ BLEACH_BIT_CLEANERS = {
|
||||||
|
|
||||||
def check_result(result, other_results):
|
def check_result(result, other_results):
|
||||||
"""Check result for warnings and errors."""
|
"""Check result for warnings and errors."""
|
||||||
|
result_ok = True
|
||||||
if not result['CS']:
|
if not result['CS']:
|
||||||
for warning in other_results.get('Warning', {}).keys():
|
for warning in other_results.get('Warning', {}).keys():
|
||||||
if warning in str(result['Error']):
|
if warning in str(result['Error']):
|
||||||
# Ignore warnings and repair statements
|
# Ignore warnings and repair statements
|
||||||
return
|
return True
|
||||||
# Error is not a warning
|
# Error is not a warning
|
||||||
ERRORS += 1
|
result_ok = False
|
||||||
|
return result_ok
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
|
|
@ -82,6 +83,7 @@ if __name__ == '__main__':
|
||||||
clear_screen()
|
clear_screen()
|
||||||
print_info('{}: System Diagnostics Tool\n'.format(KIT_NAME_FULL))
|
print_info('{}: System Diagnostics Tool\n'.format(KIT_NAME_FULL))
|
||||||
ticket_number = get_ticket_number()
|
ticket_number = get_ticket_number()
|
||||||
|
system_ok = True
|
||||||
other_results = {
|
other_results = {
|
||||||
'Error': {
|
'Error': {
|
||||||
'CalledProcessError': 'Unknown Error',
|
'CalledProcessError': 'Unknown Error',
|
||||||
|
|
@ -120,19 +122,18 @@ if __name__ == '__main__':
|
||||||
result = try_and_print(
|
result = try_and_print(
|
||||||
message='CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']),
|
message='CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']),
|
||||||
function=run_chkdsk, other_results=other_results)
|
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...',
|
result = try_and_print(message='SFC scan...',
|
||||||
function=run_sfc_scan, other_results=other_results)
|
function=run_sfc_scan, other_results=other_results)
|
||||||
check_result(result, other_results)
|
system_ok &= check_result(result, other_results)
|
||||||
if D7_MODE:
|
if D7_MODE:
|
||||||
result = try_and_print(message='DISM RestoreHealth...',
|
result = try_and_print(message='DISM RestoreHealth...',
|
||||||
function=run_dism, other_results=other_results, repair=True)
|
function=run_dism, other_results=other_results, repair=True)
|
||||||
check_result(result, other_results)
|
system_ok &= check_result(result, other_results)
|
||||||
else:
|
else:
|
||||||
try_and_print(message='DISM CheckHealth...',
|
try_and_print(message='DISM CheckHealth...',
|
||||||
function=run_dism, other_results=other_results, repair=False)
|
function=run_dism, other_results=other_results, repair=False)
|
||||||
|
|
||||||
|
|
||||||
if D7_MODE:
|
if D7_MODE:
|
||||||
# Archive all browsers for all users
|
# Archive all browsers for all users
|
||||||
archive_all_users()
|
archive_all_users()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue