Class: OsCtld::Container::Hooks::Base
- Inherits:
-
Hook::Base
- Object
- Hook::Base
- OsCtld::Container::Hooks::Base
- Defined in:
- lib/osctld/container/hooks.rb
Direct Known Subclasses
OnStart, OnStop, PostMount, PostStart, PostStop, PreMount, PreStart, PreStop, VethDown, VethUp
Instance Attribute Summary collapse
- #ct ⇒ Container readonly
Attributes inherited from Hook::Base
Class Method Summary collapse
-
.ct_hook(hook_name) ⇒ Object
Register container hook under a name.
Instance Method Summary collapse
- #environment ⇒ Object protected
- #setup ⇒ Object
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
Class Method Details
.ct_hook(hook_name) ⇒ Object
Register container hook under a name
8 9 10 |
# File 'lib/osctld/container/hooks.rb', line 8 def self.ct_hook(hook_name) hook(Container, hook_name, self) end |
Instance Method Details
#environment ⇒ Object (protected)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/osctld/container/hooks.rb', line 21 def environment super.merge({ 'OSCTL_POOL_NAME' => ct.pool.name, 'OSCTL_CT_ID' => ct.id, 'OSCTL_CT_USER' => ct.user.name, 'OSCTL_CT_GROUP' => ct.group.name, 'OSCTL_CT_DATASET' => ct.get_run_conf.dataset.to_s, 'OSCTL_CT_ROOTFS' => ct.get_run_conf.rootfs, 'OSCTL_CT_LXC_PATH' => ct.lxc_home, 'OSCTL_CT_LXC_DIR' => ct.lxc_dir, 'OSCTL_CT_CGROUP_PATH' => ct.cgroup_path, 'OSCTL_CT_DISTRIBUTION' => ct.get_run_conf.distribution, 'OSCTL_CT_VERSION' => ct.get_run_conf.version, 'OSCTL_CT_HOSTNAME' => ct.hostname.to_s, 'OSCTL_CT_LOG_FILE' => ct.log_path }) end |
#setup ⇒ Object
15 16 17 |
# File 'lib/osctld/container/hooks.rb', line 15 def setup @ct = event_instance end |