Skip to content

Commit

Permalink
feat (trivial): use ops to tell juju to reboot the machine. (#146)
Browse files Browse the repository at this point in the history
* Use ops to tell juju to reboot the machine.

* Fix version requirement.
  • Loading branch information
tonyandrewmeyer authored Nov 14, 2023
1 parent 07e0cbd commit d5afde0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ghapi
jinja2
ops
ops>=2.8
pylxd @ git+https://github.com/canonical/pylxd
requests
typing-extensions
Expand Down
7 changes: 1 addition & 6 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,7 @@ def _update_kernel(self, now: bool = False) -> None:
_, exit_code = execute_command(["ls", "/var/run/reboot-required"], check_exit=False)
if exit_code == 0:
logger.info("Rebooting system...")

# The juju-reboot is inject to PATH by juju.
cmd = ["juju-reboot"]
if now:
cmd += ["--now"]
execute_command(cmd)
self.unit.reboot(now=now)

@catch_charm_errors
def _on_upgrade_charm(self, _event: UpgradeCharmEvent) -> None:
Expand Down

0 comments on commit d5afde0

Please sign in to comment.