Class: Haconiwa::Base

Inherits:
Object
  • Object
show all
Extended by:
Utils
Defined in:
lib/haconiwa/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils

sethostname

Constructor Details

#initializeBase

Returns a new instance of Base.



21
22
23
24
25
26
27
# File 'lib/haconiwa/base.rb', line 21

def initialize
  @filesystem = Filesystem.new
  @cgroup = CGroup.new
  @namespace = Namespace.new
  @capabilities = Capabilities.new
  @name = "haconiwa-#{Time.now.to_i}"
end

Instance Attribute Details

#capabilitiesObject

Returns the value of attribute capabilities.



10
11
12
# File 'lib/haconiwa/base.rb', line 10

def capabilities
  @capabilities
end

#cgroupObject

Returns the value of attribute cgroup.



10
11
12
# File 'lib/haconiwa/base.rb', line 10

def cgroup
  @cgroup
end

#filesystemObject

Returns the value of attribute filesystem.



10
11
12
# File 'lib/haconiwa/base.rb', line 10

def filesystem
  @filesystem
end

#init_commandObject

Returns the value of attribute init_command.



10
11
12
# File 'lib/haconiwa/base.rb', line 10

def init_command
  @init_command
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/haconiwa/base.rb', line 10

def name
  @name
end

#namespaceObject

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



17
18
19
# File 'lib/haconiwa/base.rb', line 17

def self.define(&b)
  new.tap(&b)
end

Instance Method Details

#add_mount_point(point, options) ⇒ Object



34
35
36
37
# File 'lib/haconiwa/base.rb', line 34

def add_mount_point(point, options)
  self.namespace.unshare "mount"
  self.filesystem.mount_points << MountPoint.new(point, options)
end

#chroot_to(dest) ⇒ Object

aliases



30
31
32
# File 'lib/haconiwa/base.rb', line 30

def chroot_to(dest)
  self.filesystem.chroot = dest
end

#mount_independent_procfsObject



39
40
41
42
# File 'lib/haconiwa/base.rb', line 39

def mount_independent_procfs
  self.namespace.unshare "mount"
  self.filesystem.mount_independent_procfs = true
end

#start(*init_command) ⇒ Object Also known as: run



44
45
46
# File 'lib/haconiwa/base.rb', line 44

def start(*init_command)
  Runners::Linux.run(self, init_command)
end