Class: Chef::Knife::StencilNode

Inherits:
Object
  • Object
show all
Includes:
StencilBase
Defined in:
lib/chef/knife/stencil_node.rb

Overview

A node (server/host)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StencilBase

#build_plugin_klass, #explain, #invoked_as_stencil?, #locate_config_value, #normalize_path, #stencil_root

Constructor Details

#initialize(name, config, options = {}) ⇒ StencilNode

Returns a new instance of StencilNode.



30
31
32
33
34
# File 'lib/chef/knife/stencil_node.rb', line 30

def initialize(name, config, options={})
	@name = name
  @config = config
  explain("Configuration #{config}")
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



28
29
30
# File 'lib/chef/knife/stencil_node.rb', line 28

def config
  @config
end

#nameObject

Returns the value of attribute name.



28
29
30
# File 'lib/chef/knife/stencil_node.rb', line 28

def name
  @name
end

Instance Method Details

#createObject

Create that node in the appropriate cloud



37
38
39
40
41
# File 'lib/chef/knife/stencil_node.rb', line 37

def create
  klass = build_plugin_klass(config[:plugin], :server, :create)
  obj = klass.new
  obj.run
end

#deleteObject

Remove that node from the appropriate cloud



44
45
46
47
48
# File 'lib/chef/knife/stencil_node.rb', line 44

def delete
  klass = build_plugin_klass(config[:plugin], :server, :delete)
  obj = klass.new
  obj.run
end