vagabond 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/CHANGELOG.md +18 -0
  2. data/README.md +125 -4
  3. data/bin/vagabond +43 -16
  4. data/lib/vagabond/actions/cluster.rb +66 -0
  5. data/lib/vagabond/actions/create.rb +12 -7
  6. data/lib/vagabond/actions/destroy.rb +69 -15
  7. data/lib/vagabond/actions/init.rb +75 -0
  8. data/lib/vagabond/actions/provision.rb +4 -2
  9. data/lib/vagabond/actions/status.rb +33 -22
  10. data/lib/vagabond/actions/up.rb +8 -1
  11. data/lib/vagabond/bootstraps/server-zero.erb +20 -0
  12. data/lib/vagabond/bootstraps/server.erb +3 -2
  13. data/lib/vagabond/constants.rb +0 -15
  14. data/lib/vagabond/cookbooks/lxc/CHANGELOG.md +16 -0
  15. data/lib/vagabond/cookbooks/lxc/Gemfile +3 -2
  16. data/lib/vagabond/cookbooks/lxc/Gemfile.lock +30 -121
  17. data/lib/vagabond/cookbooks/lxc/README.md +43 -14
  18. data/lib/vagabond/cookbooks/lxc/attributes/default.rb +3 -3
  19. data/lib/vagabond/cookbooks/lxc/files/default/lxc-awesome-ephemeral +499 -0
  20. data/lib/vagabond/cookbooks/lxc/libraries/lxc.rb +223 -58
  21. data/lib/vagabond/cookbooks/lxc/libraries/lxc_file_config.rb +3 -0
  22. data/lib/vagabond/cookbooks/lxc/libraries/monkey.rb +51 -0
  23. data/lib/vagabond/cookbooks/lxc/metadata.rb +6 -5
  24. data/lib/vagabond/cookbooks/lxc/providers/config.rb +9 -16
  25. data/lib/vagabond/cookbooks/lxc/providers/container.rb +241 -229
  26. data/lib/vagabond/cookbooks/lxc/providers/default.rb +57 -0
  27. data/lib/vagabond/cookbooks/lxc/providers/ephemeral.rb +40 -0
  28. data/lib/vagabond/cookbooks/lxc/providers/fstab.rb +13 -54
  29. data/lib/vagabond/cookbooks/lxc/providers/interface.rb +13 -67
  30. data/lib/vagabond/cookbooks/lxc/providers/service.rb +14 -14
  31. data/lib/vagabond/cookbooks/lxc/recipes/default.rb +17 -4
  32. data/lib/vagabond/cookbooks/lxc/recipes/install_dependencies.rb +1 -1
  33. data/lib/vagabond/cookbooks/lxc/resources/config.rb +2 -2
  34. data/lib/vagabond/cookbooks/lxc/resources/container.rb +31 -6
  35. data/lib/vagabond/cookbooks/lxc/resources/default.rb +12 -0
  36. data/lib/vagabond/cookbooks/lxc/resources/ephemeral.rb +13 -0
  37. data/lib/vagabond/cookbooks/lxc/resources/fstab.rb +2 -1
  38. data/lib/vagabond/cookbooks/lxc/resources/interface.rb +6 -3
  39. data/lib/vagabond/cookbooks/lxc/resources/service.rb +1 -1
  40. data/lib/vagabond/cookbooks/lxc/templates/default/file_content.erb +2 -0
  41. data/lib/vagabond/cookbooks/lxc/templates/default/interface.erb +9 -3
  42. data/lib/vagabond/cookbooks/vagabond/README.md +10 -0
  43. data/lib/vagabond/cookbooks/vagabond/attributes/default.rb +1 -0
  44. data/lib/vagabond/cookbooks/vagabond/files/default/lxc-centos +13 -6
  45. data/lib/vagabond/cookbooks/vagabond/metadata.rb +1 -0
  46. data/lib/vagabond/cookbooks/vagabond/recipes/default.rb +46 -4
  47. data/lib/vagabond/cookbooks/vagabond/recipes/zero.rb +9 -0
  48. data/lib/vagabond/errors.rb +23 -0
  49. data/lib/vagabond/helpers.rb +41 -14
  50. data/lib/vagabond/internal_configuration.rb +120 -27
  51. data/lib/vagabond/kitchen.rb +143 -63
  52. data/lib/vagabond/knife.rb +8 -5
  53. data/lib/vagabond/layout.rb +16 -0
  54. data/lib/vagabond/monkey/kitchen_config.rb +23 -0
  55. data/lib/vagabond/server.rb +79 -63
  56. data/lib/vagabond/spec.rb +345 -0
  57. data/lib/vagabond/uploader.rb +30 -0
  58. data/lib/vagabond/uploader/berkshelf.rb +53 -0
  59. data/lib/vagabond/uploader/knife.rb +24 -0
  60. data/lib/vagabond/uploader/librarian.rb +31 -0
  61. data/lib/vagabond/vagabond.rb +30 -11
  62. data/lib/vagabond/vagabondfile.rb +40 -5
  63. data/lib/vagabond/version.rb +1 -1
  64. data/vagabond.gemspec +5 -2
  65. metadata +75 -15
  66. data/lib/vagabond/cookbooks/lxc/resources/#container.rb# +0 -28
  67. data/lib/vagabond/cookbooks/lxc/test/kitchen/Kitchenfile +0 -7
  68. data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/metadata.rb +0 -2
  69. data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/recipes/centos_lxc.rb +0 -0
  70. data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/recipes/chef-bootstrap.rb +0 -0
  71. data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/recipes/lxc_files.rb +0 -0
  72. data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/recipes/lxc_templates.rb +0 -0
  73. data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/recipes/ubuntu_lxc.rb +0 -0
@@ -0,0 +1,57 @@
1
+ def load_current_resource
2
+ @lxc = ::Lxc.new(
3
+ new_resource.name,
4
+ :base_dir => node[:lxc][:container_directory],
5
+ :dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
6
+ )
7
+ end
8
+
9
+ action :create do
10
+ _lxc = @lxc
11
+ execute "LXC Create: #{new_resource.name}" do
12
+ command "lxc-create -n #{new_resource.name} -t #{new_resource.template} -- #{new_resource.template_opts.to_a.flatten.join(' ')}"
13
+ only_if do
14
+ !_lxc.exists? && new_resource.updated_by_last_action(true)
15
+ end
16
+ end
17
+ end
18
+
19
+ action :clone do
20
+ _lxc = @lxc
21
+ _base_lxc = ::Lxc.new(
22
+ new_resource.base_container,
23
+ :base_dir => node[:lxc][:container_directory],
24
+ :dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
25
+ )
26
+
27
+ unless(_base_lxc.exists?)
28
+ raise "LXC clone failed! Base container #{new_resource.base_container} does not exist. Cannot create #{new_resource.name}"
29
+ end
30
+
31
+ execute "LXC Clone: #{new_resource.base_container} -> #{new_resource.name}" do
32
+ command "lxc-clone -o #{new_resource.base_container} -n #{new_resource.name}"
33
+ only_if do
34
+ !_lxc.exists? && new_resource.updated_by_last_action(true)
35
+ end
36
+ end
37
+
38
+ end
39
+
40
+ action :delete do
41
+ _lxc = @lxc
42
+ ruby_block "Stop container #{new_resource.name}" do
43
+ block do
44
+ _lxc.shutdown
45
+ end
46
+ only_if do
47
+ _lxc.exists? && _lxc.running?
48
+ end
49
+ end
50
+
51
+ execute "Destroy container #{new_resource.name}" do
52
+ command "lxc-destroy #{new_resource.name}"
53
+ only_if do
54
+ _lxc.exists?
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,40 @@
1
+ use_inline_resources if self.respond_to?(:use_inline_resources)
2
+
3
+ def load_current_resource
4
+ @lxc = ::Lxc.new(
5
+ new_resource.base_container,
6
+ :base_dir => node[:lxc][:container_directory],
7
+ :dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
8
+ )
9
+ unless(@lxc.exists?)
10
+ raise "Requested base contianer: #{new_resource.base_container} does not exist"
11
+ end
12
+ @start_script = node[:lxc][:awesome_ephemerals] ? '/usr/local/bin/lxc-awesome-ephemeral' : 'lxc-ephemeral-start'
13
+ unless(node[:lxc][:awesome_ephemerals])
14
+ %w(host_rootfs virtual_device).each do |key|
15
+ if(resource.send(key))
16
+ raise "#{key} lxc ephemeral attribute only valid when awesome_ephemerals is true!"
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ action :run do
23
+ com = [@start_script]
24
+ com << "-o #{new_resource.base_container}"
25
+ com << "-b #{new_resource.bind_directory}" if new_resource.bind_directory
26
+ com << "-U #{new_resource.union_type}"
27
+ com << "-u #{new_resource.user}"
28
+ com << "-S #{new_resource.key}"
29
+ com << "-z #{new_resource.host_rootfs}" if new_resource.host_rootfs
30
+ com << "-D #{new_resource.virtual_device}" if new_resource.virtual_device
31
+ if(new_resource.background)
32
+ Chef::Log.warn("Ephemeral container will be backgrounded: #{new_resource.name}")
33
+ com << '-d'
34
+ end
35
+ com << "\"#{new_resource.command}\"" # TODO: fix this to be proper
36
+ execute "LXC ephemeral: #{new_resource.name}" do
37
+ command com.join(' ')
38
+ stream_output new_resource.stream_output
39
+ end
40
+ end
@@ -1,71 +1,30 @@
1
1
  def load_current_resource
2
- new_resource._lxc Lxc.new(
3
- new_resource.container,
4
- :base_dir => node[:lxc][:container_directory],
5
- :dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
6
- )
7
- @loaded ||= {}
2
+ if(new_resource.auto_join_rootfs_mount)
3
+ new_resource.mount_point(
4
+ ::Lxc.new(new_resource.container).rootfs.join(
5
+ new_resource.mount_point
6
+ ).to_path
7
+ )
8
+ end
8
9
  node.run_state[:lxc] ||= Mash.new
9
10
  node.run_state[:lxc][:fstabs] ||= Mash.new
10
11
  node.run_state[:lxc][:fstabs][new_resource.container] ||= []
11
12
  end
12
13
 
13
14
  action :create do
14
- unless(@loaded[new_resource.container])
15
- @loaded[new_resource.container] = true
16
- ruby_block "lxc_fstab_notifier[#{new_resource.container}]" do
17
- action :create
18
- block{ true }
19
- only_if do
20
- new_resource.updated_by_last_action?
21
- end
22
- end
23
- template ::File.join(new_resource._lxc.container_path, 'fstab') do
24
- cookbook 'lxc'
25
- source 'fstab.erb'
26
- mode 0644
27
- variables :container => new_resource.container
28
- subscribes :create, resources(:ruby_block => "lxc_fstab_notifier[#{new_resource.container}]"), :delayed
29
- end
30
- end
31
15
 
32
16
  line = "#{new_resource.file_system}\t#{new_resource.mount_point}\t" <<
33
17
  "#{new_resource.type}\t#{Array(new_resource.options).join(',')}\t" <<
34
18
  "#{new_resource.dump}\t#{new_resource.pass}"
35
19
 
20
+ if(new_resource.create_mount_point)
21
+ directory new_resource.mount_point do
22
+ recursive true
23
+ end
24
+ end
25
+
36
26
  unless(node.run_state[:lxc][:fstabs][new_resource.container].include?(line))
37
27
  node.run_state[:lxc][:fstabs][new_resource.container] << line
38
- new_resource.updated_by_last_action(true)
39
- end
40
-
41
- end
42
-
43
- action :delete do
44
- unless(@loaded[new_resource.container])
45
- @loaded[new_resource.container] = true
46
-
47
- ruby_block "lxc_fstab_notifier[#{new_resource.container}]" do
48
- action :create
49
- block{ true }
50
- only_if do
51
- new_resource.updated_by_last_action?
52
- end
53
- end
54
-
55
- template ::File.join(new_resource._lxc.container_path, 'fstab') do
56
- cookbook 'lxc'
57
- source 'fstab.erb'
58
- mode 0644
59
- variables :container => new_resource.container
60
- subscribes :create, resources(:ruby_block => "lxc_fstab_notifier[#{new_resource.container}]"), :delayed
61
- end
62
28
  end
63
29
 
64
- line = "#{new_resource.file_system}\t#{new_resource.mount_point}\t" <<
65
- "#{new_resource.type}\t#{Array(new_resource.options).join(' ')}\t" <<
66
- "#{new_resource.dump}\t#{new_resource.pass}"
67
- if(node.run_state[:lxc][:fstabs][new_resource.container].include?(line))
68
- node.run_state[:lxc][:fstabs][new_resource.container].delete(line)
69
- new_resource.updated_by_last_action(true)
70
- end
71
30
  end
@@ -1,5 +1,5 @@
1
1
  def load_current_resource
2
- @lxc = Lxc.new(
2
+ @lxc = ::Lxc.new(
3
3
  new_resource.container,
4
4
  :base_dir => node[:lxc][:container_directory],
5
5
  :dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
@@ -11,89 +11,35 @@ def load_current_resource
11
11
  raise "#{key} is required for static interfaces" if new_resource.send(key).nil?
12
12
  end
13
13
  end
14
- # address checks
15
- unless(new_resource.dynamic)
16
- %w(address).each do |key|
17
- new_resource.send(key).split('.').each do |oct|
18
- raise "#{key} is not a valid address" if oct.to_i > 254
19
- end
20
- end
21
- new_resource.netmask.split('.').each do |oct|
22
- raise 'netmask is not valid' if oct.to_i > 255
23
- end
24
- end
25
- interfaces = node[:lxc][:interfaces] || Mash.new
26
- interfaces[new_resource.container] ||= []
27
- node[:lxc][:interfaces] = interfaces
14
+ node.run_state[:lxc] ||= Mash.new
15
+ node.run_state[:lxc][:interfaces] ||= Mash.new
16
+ node.run_state[:lxc][:interfaces][new_resource.container] ||= []
28
17
  end
29
18
 
30
19
  action :create do
20
+ raise 'Device is required for creating an LXC interface!' unless new_resource.device
21
+
31
22
  unless(@loaded[new_resource.container])
32
23
  @loaded[new_resource.container] = true
33
- ruby_block "lxc_interface_notifier[#{new_resource.container}]" do
34
- action :create
35
- block{ true }
36
- only_if do
37
- new_resource.updated_by_last_action?
38
- end
39
- end
40
- template ::File.join(@lxc.rootfs, 'etc', 'network', 'interfaces') do
41
- source 'interface.erb'
42
- cookbook 'lxc'
43
- variables :container => new_resource.container
44
- subscribes :create, resources(:ruby_block => "lxc_interface_notifier[#{new_resource.container}]"), :delayed
45
- mode 0644
46
- end
47
24
  end
48
25
 
49
26
  net_set = Mash.new(:device => new_resource.device)
50
27
  if(new_resource.dynamic)
51
28
  net_set[:dynamic] = true
52
29
  else
30
+ net_set[:auto] = new_resource.auto
53
31
  net_set[:address] = new_resource.address
54
32
  net_set[:gateway] = new_resource.gateway
55
33
  net_set[:netmask] = new_resource.netmask
34
+ net_set[:up] = new_resource.up if new_resource.up
35
+ net_set[:down] = new_resource.down if new_resource.down
36
+ net_set[:ipv6] = new_resource.ipv6
56
37
  end
57
38
 
58
- unless(node[:lxc][:interfaces][new_resource.container].include?(net_set))
59
- current_interfaces = node[:lxc][:interfaces][new_resource.container].dup
60
- current_interfaces << net_set
61
- node[:lxc][:interfaces][new_resource.contaienr] = current_interfaces
62
- new_resource.updated_by_last_action(true)
63
- end
39
+ node.run_state[:lxc][:interfaces][new_resource.container] << net_set
64
40
  end
65
41
 
66
42
  action :delete do
67
- unless(@loaded[new_resource.container])
68
- @loaded[new_resource.container] = true
69
- ruby_block "lxc_interface_notifier[#{new_resource.container}]" do
70
- action :create
71
- block{ true }
72
- only_if do
73
- new_resource.updated_by_last_action?
74
- end
75
- end
76
- template ::File.join(@lxc.rootfs, 'etc', 'interfaces') do
77
- cookbook 'lxc'
78
- source 'interface.erb'
79
- variables :container => new_resource.container
80
- subscribes :create, resources(:ruby_block => "lxc_interface_notifier[#{new_resource.container}]"), :delayed
81
- end
82
- end
83
-
84
- net_set = Mash.new(:device => new_resource.device)
85
- if(new_resource.dynamic)
86
- net_set[:dynamic] = true
87
- else
88
- net_set[:address] = new_resource.address
89
- net_set[:gateway] = new_resource.gateway
90
- net_set[:netmask] = new_resource.netmask
91
- end
92
-
93
- if(node[:lxc][:interfaces][new_resource.container].include?(net_set))
94
- current_interfaces = node[:lxc][:interfaces][new_resource.container].dup
95
- current_interfaces.delete(net_set)
96
- node[:lxc][:interfaces][new_resource.contaienr] = current_interfaces
97
- new_resource.updated_by_last_action(true)
98
- end
43
+ # do nothing, simply not provided to run_state, and thus implicitly
44
+ # deleted
99
45
  end
@@ -1,5 +1,5 @@
1
1
  def load_current_resource
2
- new_resource._lxc Lxc.new(
2
+ @lxc = ::Lxc.new(
3
3
  new_resource.name,
4
4
  :base_dir => node[:lxc][:container_directory],
5
5
  :dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
@@ -10,44 +10,44 @@ def load_current_resource
10
10
  end
11
11
 
12
12
  action :start do
13
- if(new_resource._lxc.stopped?)
14
- new_resource._lxc.start
13
+ if(@lxc.stopped?)
14
+ @lxc.start
15
15
  new_resource.updated_by_last_action(true)
16
16
  end
17
17
  end
18
18
 
19
19
  action :halt do
20
- if(new_resource._lxc.running?)
21
- new_resource._lxc.stop
20
+ if(@lxc.running?)
21
+ @lxc.stop
22
22
  new_resource.updated_by_last_action(true)
23
23
  end
24
24
  end
25
25
 
26
26
  action :restart do
27
- if(new_resource._lxc.running?)
28
- new_resource._lxc.shutdown
27
+ if(@lxc.running?)
28
+ @lxc.shutdown
29
29
  end
30
- new_resource._lxc.start
30
+ @lxc.start
31
31
  new_resource.updated_by_last_action(true)
32
32
  end
33
33
 
34
34
  action :stop do
35
- if(new_resource._lxc.running?)
36
- new_resource._lxc.stop
35
+ if(@lxc.running?)
36
+ @lxc.stop
37
37
  new_resource.updated_by_last_action(true)
38
38
  end
39
39
  end
40
40
 
41
41
  action :freeze do
42
- if(new_resource._lxc.running?)
43
- new_resource._lxc.freeze
42
+ if(@lxc.running?)
43
+ @lxc.freeze
44
44
  new_resource.updated_by_last_action(true)
45
45
  end
46
46
  end
47
47
 
48
48
  action :unfreeze do
49
- if(new_resource._lxc.frozen?)
50
- new_resource._lxc.unfreeze
49
+ if(@lxc.frozen?)
50
+ @lxc.unfreeze
51
51
  new_resource.updated_by_last_action(true)
52
52
  end
53
53
  end
@@ -5,6 +5,15 @@ end
5
5
 
6
6
  include_recipe 'lxc::install_dependencies'
7
7
 
8
+ directory '/usr/local/bin' do
9
+ recursive true
10
+ end
11
+
12
+ cookbook_file '/usr/local/bin/lxc-awesome-ephemeral' do
13
+ source 'lxc-awesome-ephemeral'
14
+ mode 0755
15
+ end
16
+
8
17
  #if the server uses the apt::cacher-client recipe, re-use it
9
18
  unless Chef::Config[:solo]
10
19
  if File.exists?('/etc/apt/apt.conf.d/01proxy')
@@ -38,8 +47,12 @@ template '/etc/default/lxc' do
38
47
  )
39
48
  end
40
49
 
41
- #this just reloads the dnsmasq rules when
42
- service "lxc-net" do
43
- action :enable
44
- subscribes :restart, resources("template[/etc/default/lxc]")
50
+ # this just reloads the dnsmasq rules when the template is adjusted
51
+ service 'lxc-net' do
52
+ action [:enable]
53
+ subscribes :restart, resources("template[/etc/default/lxc]"), :immediately
54
+ end
55
+
56
+ service 'lxc' do
57
+ action [:enable, :start]
45
58
  end
@@ -11,5 +11,5 @@ raise 'OpenSuse not currently supported' if node[:lxc][:allowed_types].include?(
11
11
 
12
12
  #store a copy of the Omnibus installer for use by the lxc containers
13
13
  if(node[:omnibus_updater] && node[:omnibus_updater][:cache_omnibus_installer])
14
- include_recipe 'omnibus_updater::deb_downloader'
14
+ include_recipe 'omnibus_updater::downloader'
15
15
  end
@@ -2,6 +2,7 @@ actions :create, :delete
2
2
  default_action :create
3
3
 
4
4
  attribute :utsname, :kind_of => String, :default => nil # defaults to resource name
5
+ attribute :aa_profile, :kind_of => String, :default => nil # platform specific?
5
6
  attribute :network, :kind_of => [Array, Hash]
6
7
  attribute :default_bridge, :kind_of => String
7
8
  attribute :static_ip, :kind_of => String
@@ -13,7 +14,6 @@ attribute :cgroup, :kind_of => Hash, :default => Mash.new
13
14
  attribute :cap_drop, :kind_of => [String, Array], :default => %w(sys_module mac_admin)
14
15
  attribute :mount, :kind_of => String
15
16
  attribute :mount_entry, :kind_of => String
16
- attribute :rootfs, :kind_of => String
17
+ attribute :rootfs, :kind_of => [String,Pathname]
17
18
  attribute :rootfs_mount, :kind_of => String
18
19
  attribute :pivotdir, :kind_of => String
19
- attribute :_lxc
@@ -1,7 +1,11 @@
1
- actions :create, :delete, :clone
1
+ def initialize(*args)
2
+ @subresources = []
3
+ super
4
+ end
5
+
6
+ actions :create, :delete
2
7
  default_action :create
3
8
 
4
- attribute :base_container, :kind_of => String
5
9
  attribute :validation_client, :kind_of => String
6
10
  attribute :validator_pem, :kind_of => String, :default => nil
7
11
  attribute :server_uri, :kind_of => String
@@ -20,10 +24,31 @@ attribute :default_config, :kind_of => [TrueClass, FalseClass], :default => true
20
24
  attribute :default_fstab, :kind_of => [TrueClass, FalseClass], :default => true
21
25
  attribute :container_commands, :kind_of => Array, :default => []
22
26
  attribute :initialize_commands, :kind_of => Array, :default => []
23
- attribute :new_container, :kind_of => [TrueClass, FalseClass], :default => false
27
+ attribute :clone, :kind_of => String
24
28
  attribute :template, :kind_of => String, :default => 'ubuntu'
25
29
  attribute :template_opts, :kind_of => Hash, :default => {}
26
30
  attribute :create_environment, :kind_of => Hash, :default => {}
27
- attribute :_lxc
28
- # TODO: We should ultimately have support for all these templates
29
- #attribute :template, :equal_to => %w(busybox debian fedora opensuse sshd ubuntu ubuntu-cloud), :default => 'ubuntu'
31
+
32
+ def fstab_mount(fname, &block)
33
+ fstab = Chef::Resource::LxcFstab.new("lxc_fstab[#{self.name} - #{fname}]", nil)
34
+ fstab.action :nothing
35
+ fstab.container self.name
36
+
37
+ @subresources << [fstab, block]
38
+ end
39
+
40
+ def interface(iname, &block)
41
+ iface = Chef::Resource::LxcInterface.new("lxc_interface[#{self.name} - #{iname}]", nil)
42
+ iface.container self.name
43
+ iface.action :nothing
44
+ @subresources << [iface, block]
45
+ end
46
+
47
+ def config(cname, &block)
48
+ conf = Chef::Resource::LxcConfig.new("lxc_config[#{self.name} - #{cname}]", nil)
49
+ conf.container self.name
50
+ conf.action :nothing
51
+ @subresources << [conf, block]
52
+ end
53
+
54
+ attr_reader :subresources