Class: PuppetX::VMware::Mapper::Node

Inherits:
MapComponent show all
Defined in:
lib/puppet_x/vmware/mapper.rb

Constant Summary collapse

Prop_names =
[
  :node_type,
  :node_type_key,
  :path_should,
  :path_is_now,
  :url,
]

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Node

Returns a new instance of Node.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/puppet_x/vmware/mapper.rb', line 92

def initialize input
  # copy input to @props hash
  super input, Prop_names

  # check for required values
  fail "#{self.class} doesn't include 'node_type'" unless
    @props[:node_type]

  # set defaults and munge
  @props[:path_is_now] ||= @props[:path_should]
    # .dup not necessary because of following map to_sym
  @props[:path_is_now] = @props[:path_is_now].map{|v| v.to_sym}
  @props[:path_should] = @props[:path_should].map{|v| v.to_sym}

  @props[:node_type_key] ||= :vsphereType if
    @props[:node_type] == :ABSTRACT
end

Instance Method Details

#path_is_now_to_typeObject



110
111
112
# File 'lib/puppet_x/vmware/mapper.rb', line 110

def path_is_now_to_type
  self.path_is_now.dup << self.node_type_key
end