Class: Haconiwa::Base
Instance Attribute Summary collapse
-
#capabilities ⇒ Object
Returns the value of attribute capabilities.
-
#cgroup ⇒ Object
Returns the value of attribute cgroup.
-
#container_pid_file ⇒ Object
Returns the value of attribute container_pid_file.
-
#filesystem ⇒ Object
Returns the value of attribute filesystem.
-
#init_command ⇒ Object
Returns the value of attribute init_command.
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
Class Method Summary collapse
Instance Method Summary collapse
- #add_mount_point(point, options) ⇒ Object
-
#chroot_to(dest) ⇒ Object
aliases.
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #mount_independent_procfs ⇒ Object
- #start(*init_command) ⇒ Object (also: #run)
Methods included from Utils
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
22 23 24 25 26 27 28 29 |
# File 'lib/haconiwa/base.rb', line 22 def initialize @filesystem = Filesystem.new @cgroup = CGroup.new @namespace = Namespace.new @capabilities = Capabilities.new @name = "haconiwa-#{Time.now.to_i}" @container_pid_file = "/var/run/haconiwa-#{@name}.pid" end |
Instance Attribute Details
#capabilities ⇒ Object
Returns the value of attribute capabilities.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def capabilities @capabilities end |
#cgroup ⇒ Object
Returns the value of attribute cgroup.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def cgroup @cgroup end |
#container_pid_file ⇒ Object
Returns the value of attribute container_pid_file.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def container_pid_file @container_pid_file end |
#filesystem ⇒ Object
Returns the value of attribute filesystem.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def filesystem @filesystem end |
#init_command ⇒ Object
Returns the value of attribute init_command.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def init_command @init_command end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def namespace @namespace end |
Class Method Details
.define(&b) ⇒ Object
18 19 20 |
# File 'lib/haconiwa/base.rb', line 18 def self.define(&b) new.tap(&b) end |
Instance Method Details
#add_mount_point(point, options) ⇒ Object
36 37 38 39 |
# File 'lib/haconiwa/base.rb', line 36 def add_mount_point(point, ) self.namespace.unshare "mount" self.filesystem.mount_points << MountPoint.new(point, ) end |
#chroot_to(dest) ⇒ Object
aliases
32 33 34 |
# File 'lib/haconiwa/base.rb', line 32 def chroot_to(dest) self.filesystem.chroot = dest end |
#mount_independent_procfs ⇒ Object
41 42 43 44 |
# File 'lib/haconiwa/base.rb', line 41 def mount_independent_procfs self.namespace.unshare "mount" self.filesystem.mount_independent_procfs = true end |