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.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/puppet_x/vmware/mapper.rb', line 110

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



128
129
130
# File 'lib/puppet_x/vmware/mapper.rb', line 128

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