have replayed curtin runs create a log file too
This commit is contained in:
parent
0f1f128dc8
commit
683d1932ac
|
@ -9,6 +9,7 @@ from systemd import journal
|
|||
|
||||
json_file = sys.argv[1]
|
||||
event_identifier = sys.argv[2]
|
||||
log_location = sys.argv[3]
|
||||
|
||||
scale_factor = float(os.environ.get('SUBIQUITY_REPLAY_TIMESCALE', "4"))
|
||||
|
||||
|
@ -17,7 +18,7 @@ def time_for_entry(e):
|
|||
|
||||
rc = 0
|
||||
|
||||
def report(e):
|
||||
def report(e, log_file):
|
||||
global rc
|
||||
if e['SYSLOG_IDENTIFIER'].startswith("curtin_event"):
|
||||
e['SYSLOG_IDENTIFIER'] = event_identifier
|
||||
|
@ -30,13 +31,17 @@ def report(e):
|
|||
rc = 1
|
||||
elif e['SYSLOG_IDENTIFIER'].startswith("curtin_log") and scale_factor < 10:
|
||||
print(e['MESSAGE'], flush=True)
|
||||
log_file.write(e['MESSAGE'] + '\n')
|
||||
|
||||
prev_ev = None
|
||||
for line in open(json_file):
|
||||
with open(log_location, 'w') as fp:
|
||||
prev_ev = None
|
||||
for line in open(json_file):
|
||||
ev = json.loads(line.strip())
|
||||
if prev_ev is not None:
|
||||
report(prev_ev)
|
||||
time.sleep(min((time_for_entry(ev) - time_for_entry(prev_ev)), 8)/scale_factor)
|
||||
report(prev_ev, fp)
|
||||
delay = time_for_entry(ev) - time_for_entry(prev_ev)
|
||||
time.sleep(min(delay, 8)/scale_factor)
|
||||
prev_ev = ev
|
||||
report(ev)
|
||||
report(ev, fp)
|
||||
|
||||
sys.exit(rc)
|
||||
|
|
|
@ -208,7 +208,9 @@ class ErrorReport(metaclass=urwid.MetaSignals):
|
|||
uploader._bg_update(uploader.bytes_sent + chunk_size)
|
||||
|
||||
def _bg_upload():
|
||||
for_upload = {}
|
||||
for_upload = {
|
||||
"Kind": self.kind.value
|
||||
}
|
||||
for k, v in self.pr.items():
|
||||
if len(v) < 1024 or k in {"Traceback", "ProcCpuinfoMinimal"}:
|
||||
for_upload[k] = v
|
||||
|
|
|
@ -329,23 +329,27 @@ class InstallProgressController(BaseController):
|
|||
|
||||
if self.opts.dry_run:
|
||||
config_location = os.path.join('.subiquity/', config_file_name)
|
||||
log_location = '.subiquity/install.log'
|
||||
event_file = "examples/curtin-events.json"
|
||||
if 'install-fail' in self.debug_flags:
|
||||
event_file = "examples/curtin-events-fail.json"
|
||||
curtin_cmd = ["python3", "scripts/replay-curtin-log.py",
|
||||
event_file, self._event_syslog_identifier]
|
||||
curtin_cmd = [
|
||||
"python3", "scripts/replay-curtin-log.py", event_file,
|
||||
self._event_syslog_identifier, log_location,
|
||||
]
|
||||
else:
|
||||
config_location = os.path.join('/var/log/installer',
|
||||
config_file_name)
|
||||
curtin_cmd = [sys.executable, '-m', 'curtin', '--showtrace', '-c',
|
||||
config_location, 'install']
|
||||
log_location = INSTALL_LOG
|
||||
|
||||
ident = self._event_syslog_identifier
|
||||
self._write_config(config_location,
|
||||
self.model.render(syslog_identifier=ident))
|
||||
|
||||
self.app.note_file_for_apport("CurtinConfig", config_location)
|
||||
self.app.note_file_for_apport("CurtinLog", INSTALL_LOG)
|
||||
self.app.note_file_for_apport("CurtinLog", log_location)
|
||||
self.app.note_file_for_apport("CurtinErrors", ERROR_TARFILE)
|
||||
|
||||
return curtin_cmd
|
||||
|
|
Loading…
Reference in New Issue