diff options
author | Paul Kocialkowski | 2023-02-08 14:13:02 +0100 |
---|---|---|
committer | Paul Kocialkowski | 2023-02-08 14:14:32 +0100 |
commit | 64b851d924d1db85748b76b7dd2d95c6a84de41d (patch) | |
tree | 9b42531a8e27d60e8db2ecf18d334c91ea9fd34d | |
parent | 0a32bbe5effb3e298925dc28e30148f1b34810ee (diff) |
host-control: Add hook support
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rwxr-xr-x | host-control | 23 |
1 files changed, 23 insertions, 0 deletions
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): |