From 50382f4fbf884ee48fb5bf51492e6f10ead60d97 Mon Sep 17 00:00:00 2001 From: andatoshiki Date: Mon, 16 Sep 2024 23:13:31 -0700 Subject: [PATCH] feat(bin): add mode parameter to `agent._restart` & and call `agent._restart` from `USR1` handler instead of `shikigotchi.restart()` --- bin/shikigotchi | 2 +- shikigotchi/agent.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/shikigotchi b/bin/shikigotchi index 421342d..874d07b 100644 --- a/bin/shikigotchi +++ b/bin/shikigotchi @@ -324,7 +324,7 @@ def shikigotchi_cli(): def usr1_handler(*unused): logging.info('Received USR1 singal. Restart process ...') - restart("MANU" if args.do_manual else "AUTO") + agent.restart("MANU" if args.do_manual else "AUTO") signal.signal(signal.SIGUSR1, usr1_handler) diff --git a/shikigotchi/agent.py b/shikigotchi/agent.py index 654f96f..a198504 100755 --- a/shikigotchi/agent.py +++ b/shikigotchi/agent.py @@ -269,9 +269,9 @@ def _reboot(self): self._save_recovery_data() shikigotchi.reboot() - def _restart(self): + def _restart(self, mode='AUTO'): self._save_recovery_data() - shikigotchi.restart("AUTO") + shikigotchi.restart(mode) def _save_recovery_data(self): logging.warning("writing recovery data to %s ...", RECOVERY_DATA_FILE)