From a824634e24f317454670f2575c752a80af5dd7f7 Mon Sep 17 00:00:00 2001 From: Gregory Giguashvili Date: Thu, 20 Jun 2024 09:15:38 +0300 Subject: [PATCH] Add log file printout to the console in case of anaconda errors --- .../includes/onerror-logs.cfg | 17 +++++++++++++++++ .../kickstart-bootc.ks.template | 2 ++ .../kickstart-centos.ks.template | 2 ++ .../kickstart-liveimg.ks.template | 2 ++ .../kickstart-offline.ks.template | 2 ++ test/kickstart-templates/kickstart.ks.template | 2 ++ 6 files changed, 27 insertions(+) create mode 100644 test/kickstart-templates/includes/onerror-logs.cfg diff --git a/test/kickstart-templates/includes/onerror-logs.cfg b/test/kickstart-templates/includes/onerror-logs.cfg new file mode 100644 index 0000000000..d7f1d5ebf8 --- /dev/null +++ b/test/kickstart-templates/includes/onerror-logs.cfg @@ -0,0 +1,17 @@ +%onerror --log=/dev/console --erroronfail +# Enable nullglob to avoid iterating if no *.log files exist +shopt -s nullglob + +# Print Anaconda logs to the console on error +echo "Displaying log files on installation failure" +for log in /tmp/*.log ; do + echo "---- ${log} ----" + cat "${log}" + echo "---- ----" +done +echo "Finished diplaying log files on installation failure" + +# Disable nullglob to restore the default behavior +shopt -u nullglob + +%end diff --git a/test/kickstart-templates/kickstart-bootc.ks.template b/test/kickstart-templates/kickstart-bootc.ks.template index 16bd94b943..9af010669c 100644 --- a/test/kickstart-templates/kickstart-bootc.ks.template +++ b/test/kickstart-templates/kickstart-bootc.ks.template @@ -11,3 +11,5 @@ %include /post-bootc-wa.cfg %end + +%include /onerror-logs.cfg diff --git a/test/kickstart-templates/kickstart-centos.ks.template b/test/kickstart-templates/kickstart-centos.ks.template index e563722f7f..efd3f1a4a8 100644 --- a/test/kickstart-templates/kickstart-centos.ks.template +++ b/test/kickstart-templates/kickstart-centos.ks.template @@ -12,3 +12,5 @@ %include /post-cos9rpm.cfg %end + +%include /onerror-logs.cfg diff --git a/test/kickstart-templates/kickstart-liveimg.ks.template b/test/kickstart-templates/kickstart-liveimg.ks.template index a70fe52ebd..d7216b3d78 100644 --- a/test/kickstart-templates/kickstart-liveimg.ks.template +++ b/test/kickstart-templates/kickstart-liveimg.ks.template @@ -11,3 +11,5 @@ %include /post-fips.cfg %end + +%include /onerror-logs.cfg diff --git a/test/kickstart-templates/kickstart-offline.ks.template b/test/kickstart-templates/kickstart-offline.ks.template index 25039c4259..a0875c7324 100644 --- a/test/kickstart-templates/kickstart-offline.ks.template +++ b/test/kickstart-templates/kickstart-offline.ks.template @@ -12,3 +12,5 @@ network --no-activate --nodefroute --hostname=REPLACE_HOST_NAME sudo semanage permissive -a virt_qemu_ga_t %end + +%include /onerror-logs.cfg diff --git a/test/kickstart-templates/kickstart.ks.template b/test/kickstart-templates/kickstart.ks.template index 320169d6f3..156f50d58d 100644 --- a/test/kickstart-templates/kickstart.ks.template +++ b/test/kickstart-templates/kickstart.ks.template @@ -11,3 +11,5 @@ %include /post-fips.cfg %end + +%include /onerror-logs.cfg