Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
1e09ddc9ff
10 changed files with 45 additions and 21 deletions
|
|
@ -1,5 +1,5 @@
|
|||
"""WizardKit: Config - ddrescue"""
|
||||
# pylint: disable=bad-whitespace,line-too-long
|
||||
# pylint: disable=line-too-long
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
from collections import OrderedDict
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
"""WizardKit: Config - Hardware"""
|
||||
# pylint: disable=bad-whitespace,line-too-long
|
||||
# pylint: disable=line-too-long
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
import re
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
NOTE: Non-standard formating is used for BASH/BATCH/PYTHON compatibility
|
||||
"""
|
||||
# pylint: disable=bad-whitespace
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
"""WizardKit: Config - Net"""
|
||||
# pylint: disable=bad-whitespace
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
"""WizardKit: Config - UFD"""
|
||||
# pylint: disable=bad-whitespace
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
from collections import OrderedDict
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
"""WizardKit: Graph Functions"""
|
||||
# pylint: disable=bad-whitespace
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
import base64
|
||||
|
|
|
|||
|
|
@ -989,6 +989,7 @@ class State():
|
|||
debug_dir.mkdir()
|
||||
|
||||
# State (self)
|
||||
std.save_pickles({'state': self}, debug_dir)
|
||||
with open(f'{debug_dir}/state.report', 'a') as _f:
|
||||
_f.write('[Debug report]\n')
|
||||
_f.write('\n'.join(debug.generate_object_report(self)))
|
||||
|
|
|
|||
|
|
@ -350,6 +350,7 @@ class State():
|
|||
debug_dir.mkdir()
|
||||
|
||||
# State (self)
|
||||
std.save_pickles({'state': self}, debug_dir)
|
||||
with open(f'{debug_dir}/state.report', 'a') as _f:
|
||||
_f.write('\n'.join(debug.generate_object_report(self)))
|
||||
|
||||
|
|
|
|||
|
|
@ -759,8 +759,9 @@ def get_disks_macos():
|
|||
disks.append(Disk(f'/dev/{disk}'))
|
||||
|
||||
# Remove virtual disks
|
||||
# TODO: Test more to figure out why some drives are being marked 'Unknown'
|
||||
disks = [
|
||||
d for d in disks if d.details.get('VirtualOrPhysical') == 'Physical'
|
||||
d for d in disks if d.details.get('VirtualOrPhysical') != 'Virtual'
|
||||
]
|
||||
|
||||
# Done
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
import inspect
|
||||
import itertools
|
||||
import logging
|
||||
import lzma
|
||||
import os
|
||||
import pathlib
|
||||
import pickle
|
||||
import platform
|
||||
import re
|
||||
import socket
|
||||
|
|
@ -26,6 +28,7 @@ from wk.cfg.main import (
|
|||
WIDTH,
|
||||
)
|
||||
from wk.cfg.net import CRASH_SERVER
|
||||
from wk.log import get_root_logger_path
|
||||
|
||||
|
||||
# STATIC VARIABLES
|
||||
|
|
@ -863,23 +866,26 @@ def major_exception():
|
|||
LOG.critical('Major exception encountered', exc_info=True)
|
||||
print_error('Major exception', log=False)
|
||||
print_warning(SUPPORT_MESSAGE)
|
||||
if ENABLED_UPLOAD_DATA:
|
||||
print_warning('Also, please run upload-logs to help debugging!')
|
||||
print(traceback.format_exc())
|
||||
|
||||
# Build report
|
||||
report = generate_debug_report()
|
||||
# TODO: Decide to remove or reinstate following section
|
||||
## Build report
|
||||
#report = generate_debug_report()
|
||||
|
||||
# Upload details
|
||||
prompt = f'Upload details to {CRASH_SERVER.get("Name", "?")}?'
|
||||
if ENABLED_UPLOAD_DATA and ask(prompt):
|
||||
print('Uploading... ', end='', flush=True)
|
||||
try:
|
||||
upload_debug_report(report, reason='CRASH')
|
||||
except Exception: #pylint: disable=broad-except
|
||||
print_error('FAILED', log=False)
|
||||
LOG.error('Upload failed', exc_info=True)
|
||||
else:
|
||||
print_success('SUCCESS', log=False)
|
||||
LOG.info('Upload successful')
|
||||
## Upload details
|
||||
#prompt = f'Upload details to {CRASH_SERVER.get("Name", "?")}?'
|
||||
#if ENABLED_UPLOAD_DATA and ask(prompt):
|
||||
# print('Uploading... ', end='', flush=True)
|
||||
# try:
|
||||
# upload_debug_report(report, reason='CRASH')
|
||||
# except Exception: # pylint: disable=broad-except
|
||||
# print_error('FAILED', log=False)
|
||||
# LOG.error('Upload failed', exc_info=True)
|
||||
# else:
|
||||
# print_success('SUCCESS', log=False)
|
||||
# LOG.info('Upload successful')
|
||||
|
||||
# Done
|
||||
pause('Press Enter to exit... ')
|
||||
|
|
@ -960,6 +966,25 @@ def print_warning(msg, log=True, **kwargs):
|
|||
LOG.warning(msg)
|
||||
|
||||
|
||||
def save_pickles(obj_dict, out_path=None):
|
||||
"""Save dict of objects using pickle."""
|
||||
LOG.info('Saving pickles')
|
||||
|
||||
# Set path
|
||||
if not out_path:
|
||||
out_path = pathlib.Path(f'{get_root_logger_path().parent}/debug')
|
||||
|
||||
# Save pickles
|
||||
try:
|
||||
for name, obj in obj_dict.copy().items():
|
||||
if name.startswith('__') or inspect.ismodule(obj):
|
||||
continue
|
||||
with open(f'{out_path}/{name}.pickle', 'wb') as _f:
|
||||
pickle.dump(obj, _f, protocol=pickle.HIGHEST_PROTOCOL)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
LOG.error('Failed to save all the pickles', exc_info=True)
|
||||
|
||||
|
||||
def set_title(title):
|
||||
"""Set window title."""
|
||||
LOG.debug('title: %s', title)
|
||||
|
|
|
|||
Loading…
Reference in a new issue