Class: OsCtld::Pool::Hooks::Base

Inherits:
Hook::Base show all
Defined in:
lib/osctld/pool/hooks.rb

Direct Known Subclasses

PostExport, PostImport, PreAutoStart, PreExport, PreImport

Instance Attribute Summary collapse

Attributes inherited from Hook::Base

#event_instance, #opts

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Hook::Base

blocking, blocking?, #blocking?, #exec, #executable, hook, #initialize

Constructor Details

This class inherits a constructor from OsCtld::Hook::Base

Instance Attribute Details

#poolPool (readonly)

Returns:



13
14
15
# File 'lib/osctld/pool/hooks.rb', line 13

def pool
  @pool
end

Class Method Details

.pool_hook(hook_name) ⇒ Object

Register pool hook under a name

Parameters:

  • hook_name (Symbol)


8
9
10
# File 'lib/osctld/pool/hooks.rb', line 8

def self.pool_hook(hook_name)
  hook(Pool, hook_name, self)
end

Instance Method Details

#environmentObject (protected)



21
22
23
24
25
26
27
# File 'lib/osctld/pool/hooks.rb', line 21

def environment
  super.merge({
    'OSCTL_POOL_NAME' => pool.name,
    'OSCTL_POOL_DATASET' => pool.dataset,
    'OSCTL_POOL_STATE' => pool.state.to_s
  })
end

#setupObject



15
16
17
# File 'lib/osctld/pool/hooks.rb', line 15

def setup
  @pool = event_instance
end