48 lines
972 B
Python
Executable file
48 lines
972 B
Python
Executable file
#!/usr/bin/env python
|
|
# vim: sts=2 sw=2 ts=2
|
|
"""Wizard Kit: Upload Logs"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
# Init
|
|
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
|
from functions.hw_diags import *
|
|
init_global_vars(silent=True)
|
|
|
|
|
|
# Functions
|
|
def main():
|
|
"""Upload logs for review."""
|
|
lines = []
|
|
|
|
# Instructions
|
|
print_success(f'{KIT_NAME_FULL}: Upload Logs')
|
|
print('')
|
|
print('Please state the reason for the review.')
|
|
print_info(' End note with an empty line.')
|
|
print('')
|
|
|
|
# Get reason note
|
|
while True:
|
|
text = input_text('> ')
|
|
if not text:
|
|
break
|
|
lines.append(text)
|
|
with open(f'{global_vars["LogDir"]}/__reason__.txt', 'a') as f:
|
|
f.write('\n'.join(lines))
|
|
|
|
# Compress and upload logs
|
|
result = try_and_print(
|
|
message='Uploading logs...',
|
|
function=upload_logdir,
|
|
indent=0,
|
|
global_vars=global_vars,
|
|
reason='Review',
|
|
)
|
|
if not result['CS']:
|
|
raise SystemExit(1)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|