Added upload-logs script
This commit is contained in:
parent
3c5f9c1bbe
commit
63adbc6b3a
1 changed files with 48 additions and 0 deletions
48
.bin/Scripts/upload-logs
Executable file
48
.bin/Scripts/upload-logs
Executable file
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/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()
|
||||||
Loading…
Reference in a new issue