Class: Chef::Resource::Lxc
- Inherits:
-
Chef::Resource
- Object
- Chef::Resource
- Chef::Resource::Lxc
- Defined in:
- lib/chef/resource/lxc.rb
Defined Under Namespace
Classes: LXCTemplate
Instance Attribute Summary collapse
-
#lxc_template ⇒ Object
readonly
Returns the value of attribute lxc_template.
-
#recipe_block ⇒ Object
readonly
Returns the value of attribute recipe_block.
Instance Method Summary collapse
- #bdev_specs(arg = nil) ⇒ Object
- #block_device(arg = nil) ⇒ Object
- #config(arg = nil) ⇒ Object
- #container_name(arg = nil) ⇒ Object
- #flags(arg = nil) ⇒ Object
-
#initialize(name, run_context = nil) ⇒ Lxc
constructor
A new instance of Lxc.
- #recipe(&block) ⇒ Object
- #template(type = 'ubuntu', &block) ⇒ Object
- #wait_for_network(arg = nil) ⇒ Object
Constructor Details
#initialize(name, run_context = nil) ⇒ Lxc
Returns a new instance of Lxc.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/chef/resource/lxc.rb', line 23 def initialize(name, run_context = nil) super @resource_name = :container @container_name = name @provider = Chef::Provider::Lxc @action = :create @allowed_actions += [:start, :stop, :destroy, :create, :reboot] @lxc_template = LXCTemplate.new @recipe_block = nil @block_device = nil @bdev_specs = {} @flags = 0 @config = {} @wait_for_network = true end |
Instance Attribute Details
#lxc_template ⇒ Object (readonly)
Returns the value of attribute lxc_template.
21 22 23 |
# File 'lib/chef/resource/lxc.rb', line 21 def lxc_template @lxc_template end |
#recipe_block ⇒ Object (readonly)
Returns the value of attribute recipe_block.
21 22 23 |
# File 'lib/chef/resource/lxc.rb', line 21 def recipe_block @recipe_block end |
Instance Method Details
#bdev_specs(arg = nil) ⇒ Object
59 60 61 |
# File 'lib/chef/resource/lxc.rb', line 59 def bdev_specs(arg = nil) set_or_return(:bdev_specs, arg, kind_of: [ Hash ] ) end |
#block_device(arg = nil) ⇒ Object
55 56 57 |
# File 'lib/chef/resource/lxc.rb', line 55 def block_device(arg = nil) set_or_return(:block_device, arg, kind_of: [ String ] ) end |
#config(arg = nil) ⇒ Object
47 48 49 |
# File 'lib/chef/resource/lxc.rb', line 47 def config(arg=nil) set_or_return(:config, arg, kind_of: [ Hash ] ) end |
#container_name(arg = nil) ⇒ Object
39 40 41 |
# File 'lib/chef/resource/lxc.rb', line 39 def container_name(arg = nil) set_or_return(:container_name, arg, kind_of: [ String ] ) end |
#flags(arg = nil) ⇒ Object
51 52 53 |
# File 'lib/chef/resource/lxc.rb', line 51 def flags(arg = nil) set_or_return(:flags, arg, kind_of: [ Fixnum ] ) end |
#recipe(&block) ⇒ Object
70 71 72 |
# File 'lib/chef/resource/lxc.rb', line 70 def recipe(&block) @recipe_block = block end |
#template(type = 'ubuntu', &block) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/chef/resource/lxc.rb', line 63 def template(type = 'ubuntu', &block) @lxc_template = LXCTemplate.new(type) if block_given? @lxc_template.instance_eval(&block) end end |
#wait_for_network(arg = nil) ⇒ Object
43 44 45 |
# File 'lib/chef/resource/lxc.rb', line 43 def wait_for_network(arg = nil) set_or_return(:wait_for_network, arg, kind_of: [ TrueClass, FalseClass ] ) end |