Skip to content

Commit

Permalink
Add logging of reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
yhaliaw committed Jul 4, 2023
1 parent 57e9207 commit 0d52bcf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d52bcf

Please sign in to comment.