From 0d52bcfc7ad51d9c66a1c8469ac1c32c16705de4 Mon Sep 17 00:00:00 2001 From: Andrew Liaw <43424755+yhaliaw@users.noreply.github.com> Date: Tue, 4 Jul 2023 13:52:25 +0800 Subject: [PATCH] Add logging of reboot --- src/charm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/charm.py b/src/charm.py index d67f8d22a..43bed783c 100755 --- a/src/charm.py +++ b/src/charm.py @@ -321,8 +321,10 @@ def _upgrade_kernel(self) -> None: """Upgrade the Linux kernel.""" execute_command(["/usr/bin/apt-get", "update"]) execute_command(["/usr/bin/apt-get", "install", "-qy", "linux-generic-hwe-22.04"]) + _, exit_code = execute_command(["ls", "/var/run/reboot-required"], check_exit=False) if exit_code == 0: + logger.info("Rebooting system...") execute_command(["reboot"]) @catch_charm_errors