Class: Skewer::PuppetNode
- Inherits:
-
Object
- Object
- Skewer::PuppetNode
- Defined in:
- lib/puppet_node.rb
Overview
responsible for creating a node definition
Instance Attribute Summary collapse
-
#nodes ⇒ Object
Returns the value of attribute nodes.
-
#puppet_repo ⇒ Object
Returns the value of attribute puppet_repo.
Instance Method Summary collapse
-
#initialize(nodes = { :default =>:noop}) ⇒ PuppetNode
constructor
A new instance of PuppetNode.
- #render ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(nodes = { :default =>:noop}) ⇒ PuppetNode
Returns a new instance of PuppetNode.
6 7 8 9 10 |
# File 'lib/puppet_node.rb', line 6 def initialize(nodes = { :default =>:noop}) @nodes = nodes config = SkewerConfig.instance @puppet_repo = config.get(:puppet_repo) end |
Instance Attribute Details
#nodes ⇒ Object
Returns the value of attribute nodes.
4 5 6 |
# File 'lib/puppet_node.rb', line 4 def nodes @nodes end |
#puppet_repo ⇒ Object
Returns the value of attribute puppet_repo.
4 5 6 |
# File 'lib/puppet_node.rb', line 4 def puppet_repo @puppet_repo end |
Instance Method Details
#render ⇒ Object
19 20 21 22 23 24 |
# File 'lib/puppet_node.rb', line 19 def render node_file_path = File.join(@puppet_repo, 'manifests','nodes.pp') file = File.new(node_file_path, 'w+') file << self.to_s file.close end |
#to_s ⇒ Object
12 13 14 15 16 17 |
# File 'lib/puppet_node.rb', line 12 def to_s require 'erb' lib_dir = File.dirname(__FILE__) template = ERB.new(File.read(File.join(lib_dir, 'node.erb'))) template.result(binding) end |