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

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Node

Returns a new instance of Node.



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/puppet_x/vmware/mapper.rb', line 139

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]
  @props[:misc] ||= Set.new()

  # 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



158
159
160
# File 'lib/puppet_x/vmware/mapper.rb', line 158

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