summaryrefslogtreecommitdiff
path: root/host-control
diff options
context:
space:
mode:
authorPaul Kocialkowski2023-02-08 14:13:02 +0100
committerPaul Kocialkowski2023-02-08 14:14:32 +0100
commit64b851d924d1db85748b76b7dd2d95c6a84de41d (patch)
tree9b42531a8e27d60e8db2ecf18d334c91ea9fd34d /host-control
parent0a32bbe5effb3e298925dc28e30148f1b34810ee (diff)
host-control: Add hook support
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'host-control')
-rwxr-xr-xhost-control23
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):