Class: OsCtld::Container::StartMenu
- Inherits:
-
Object
- Object
- OsCtld::Container::StartMenu
- Includes:
- OsCtl::Lib::Utils::Log
- Defined in:
- lib/osctld/container/start_menu.rb
Instance Attribute Summary collapse
-
#ct ⇒ Object
readonly
Returns the value of attribute ct.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Class Method Summary collapse
Instance Method Summary collapse
- #ct_path ⇒ Object
- #deploy ⇒ Object
- #dump ⇒ Object
- #dup(new_ct) ⇒ Object
- #host_path ⇒ Object
- #init_cmd(cmd) ⇒ Object
-
#initialize(ct, timeout) ⇒ StartMenu
constructor
A new instance of StartMenu.
- #log_type ⇒ Object
- #unlink ⇒ Object
Constructor Details
#initialize(ct, timeout) ⇒ StartMenu
Returns a new instance of StartMenu.
14 15 16 17 |
# File 'lib/osctld/container/start_menu.rb', line 14 def initialize(ct, timeout) @ct = ct @timeout = timeout end |
Instance Attribute Details
#ct ⇒ Object (readonly)
Returns the value of attribute ct.
12 13 14 |
# File 'lib/osctld/container/start_menu.rb', line 12 def ct @ct end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
12 13 14 |
# File 'lib/osctld/container/start_menu.rb', line 12 def timeout @timeout end |
Class Method Details
.load(ct, cfg) ⇒ Object
6 7 8 |
# File 'lib/osctld/container/start_menu.rb', line 6 def self.load(ct, cfg) new(ct, cfg['timeout'] || 5) end |
Instance Method Details
#ct_path ⇒ Object
39 40 41 |
# File 'lib/osctld/container/start_menu.rb', line 39 def ct_path File.join('/', ct.mounts.shared_dir.mountpoint, 'ctstartmenu') end |
#deploy ⇒ Object
19 20 21 22 23 |
# File 'lib/osctld/container/start_menu.rb', line 19 def deploy FileUtils.copy_file(Daemon.get.config., host_path, preserve: true) rescue SystemCallError => e log(:fatal, "Unable to deploy start menu: #{e.} (#{e.class})") end |
#dump ⇒ Object
43 44 45 46 47 |
# File 'lib/osctld/container/start_menu.rb', line 43 def dump { 'timeout' => timeout } end |
#dup(new_ct) ⇒ Object
49 50 51 52 53 |
# File 'lib/osctld/container/start_menu.rb', line 49 def dup(new_ct) ret = super() ret.instance_variable_set('@ct', new_ct) ret end |
#host_path ⇒ Object
35 36 37 |
# File 'lib/osctld/container/start_menu.rb', line 35 def host_path File.join(ct.mounts.shared_dir.path, 'ctstartmenu') end |
#init_cmd(cmd) ⇒ Object
31 32 33 |
# File 'lib/osctld/container/start_menu.rb', line 31 def init_cmd(cmd) [ct_path, '-timeout', timeout.to_s].concat(cmd) end |
#log_type ⇒ Object
55 56 57 |
# File 'lib/osctld/container/start_menu.rb', line 55 def log_type ct.log_type end |
#unlink ⇒ Object
25 26 27 28 29 |
# File 'lib/osctld/container/start_menu.rb', line 25 def unlink File.unlink(host_path) rescue Errno::ENOENT # ignore end |