Merge pull request #1619 from blackboxsw/preserve-cloud-init-logs-in-target

cloud-init: preserve ephemeral cloud-init logs in target to aid in debug
This commit is contained in:
Dan Bungert 2023-03-29 16:16:11 -06:00 committed by GitHub
commit 84e79faa41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -100,6 +100,18 @@ class ShutdownController(SubiquityController):
if self.opts.dry_run:
os.makedirs(target_logs, exist_ok=True)
else:
# Preserve ephemeral boot cloud-init logs if applicable
cloudinit_logs = [
cloudinit_log
for cloudinit_log in (
"/var/log/cloud-init.log",
"/var/log/cloud-init-output.log"
)
if os.path.exists(cloudinit_log)
]
if cloudinit_logs:
await arun_command(
['cp', '-a'] + cloudinit_logs + ['/var/log/installer'])
await arun_command(
['cp', '-aT', '/var/log/installer', target_logs])
# Close the permissions from group writes on the target.