summaryrefslogtreecommitdiff
path: root/lib/oxidized/hook/noophook.rb
diff options
context:
space:
mode:
authorAnton Aksola <anton.aksola@nebula.fi>2015-08-28 11:05:18 +0300
committerAnton Aksola <anton.aksola@nebula.fi>2015-08-28 11:05:18 +0300
commit0906e02a8538b698ed8bd7c72e6a09d3e809b67a (patch)
treed494ee43f71d41034efa98f5b5ab59ab5500207a /lib/oxidized/hook/noophook.rb
parent18cf96b36e54cb52c678e4e6395e595b6f9b4159 (diff)
Initial implementation of the hook feature
The current implementation is modular and allows users to define hooks in several ways: * Use one of the built-in hook types (currently only 'exec') * Define their own Hook classes inside ~/.config/oxidized/hook Exec hook type runs a user defined command with or without shell. It populates a bunch of environment variables with metadata. The command can either be run as synchronous or asynchronous. The default is synchronous.
Diffstat (limited to 'lib/oxidized/hook/noophook.rb')
-rw-r--r--lib/oxidized/hook/noophook.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/oxidized/hook/noophook.rb b/lib/oxidized/hook/noophook.rb
new file mode 100644
index 0000000..d4673ba
--- /dev/null
+++ b/lib/oxidized/hook/noophook.rb
@@ -0,0 +1,9 @@
+class NoopHook < Oxidized::Hook
+ def validate_cfg!
+ log "Validate config"
+ end
+
+ def run_hook ctx
+ log "Run hook with context: #{ctx}"
+ end
+end