From 0906e02a8538b698ed8bd7c72e6a09d3e809b67a Mon Sep 17 00:00:00 2001 From: Anton Aksola Date: Fri, 28 Aug 2015 11:05:18 +0300 Subject: 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. --- lib/oxidized/hook/noophook.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 lib/oxidized/hook/noophook.rb (limited to 'lib/oxidized/hook/noophook.rb') 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 -- cgit v1.2.1