From 64b851d924d1db85748b76b7dd2d95c6a84de41d Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Wed, 8 Feb 2023 14:13:02 +0100 Subject: host-control: Add hook support Signed-off-by: Paul Kocialkowski --- host-control | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/host-control b/host-control index 47f8716..c9e0cb0 100755 --- a/host-control +++ b/host-control @@ -85,6 +85,29 @@ class host_control(): return None + # hook + + def hook_lookup(self, host, name): + if not "hooks" in host: + self.print_message("No hooks in host: " + self.host) + return None + + for h in host["hooks"]: + if not "target" in h: + continue + + if h["target"] == name: + return h + + self.print_message("No hook for " + name + " in host: " + self.host) + return None + + def hook_command(self, hook): + if "command" not in hook: + return None + + return [ hook["command"] ] + # config def config_path(self): -- cgit v1.2.3