Top Level Namespace

Defined Under Namespace

Modules: ChefLxc, LxcMonkey, Vagabond Classes: Chef, Lxc, LxcFileConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#subresourcesObject (readonly)

Returns the value of attribute subresources.



54
55
56
# File 'lib/vagabond/cookbooks/lxc/resources/container.rb', line 54

def subresources
  @subresources
end

Instance Method Details

#config(cname, &block) ⇒ Object



47
48
49
50
51
52
# File 'lib/vagabond/cookbooks/lxc/resources/container.rb', line 47

def config(cname, &block)
  conf = Chef::Resource::LxcConfig.new("lxc_config[#{self.name} - #{cname}]", nil)
  conf.container self.name
  conf.action :nothing
  @subresources << [conf, block]
end

#fstab_mount(fname, &block) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/vagabond/cookbooks/lxc/resources/container.rb', line 32

def fstab_mount(fname, &block)
  fstab = Chef::Resource::LxcFstab.new("lxc_fstab[#{self.name} - #{fname}]", nil)
  fstab.action :nothing
  fstab.container self.name

  @subresources << [fstab, block]
end

#initialize(*args) ⇒ Object



1
2
3
4
# File 'lib/vagabond/cookbooks/lxc/resources/container.rb', line 1

def initialize(*args)
  @subresources = []
  super
end

#interface(iname, &block) ⇒ Object



40
41
42
43
44
45
# File 'lib/vagabond/cookbooks/lxc/resources/container.rb', line 40

def interface(iname, &block)
  iface = Chef::Resource::LxcInterface.new("lxc_interface[#{self.name} - #{iname}]", nil)
  iface.container self.name
  iface.action :nothing
  @subresources << [iface, block]
end

#load_current_resourceObject



1
2
3
4
5
6
7
8
9
10
11
12
# File 'lib/vagabond/cookbooks/lxc/providers/fstab.rb', line 1

def load_current_resource
  if(new_resource.auto_join_rootfs_mount)
    new_resource.mount_point(
      ::Lxc.new(new_resource.container).rootfs.join(
        new_resource.mount_point
      ).to_path
    )
  end
  node.run_state[:lxc] ||= Mash.new
  node.run_state[:lxc][:fstabs] ||= Mash.new
  node.run_state[:lxc][:fstabs][new_resource.container] ||= []
end