Class: PuppetX::VMware::MapperNsx::Node

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

Constant Summary collapse

Prop_names =
[
  :misc,
  :node_type,
  :node_types,
  :node_type_key,
  :olio,
  :path_should,
  :path_is_now,
  :url,
  :xml_attr,
  :xml_order,
  :xml_ns,
  :xml_type,
]

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Node

Returns a new instance of Node.



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/puppet_x/vmware/mapper_nsx.rb', line 144

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()
  @props[:olio]      ||= {}
  @props[:xml_order] ||= []
  @props[:xml_attr]  ||= []
  @props[:xml_type]  ||= ""
  @props[:xml_ns]    ||= ""
  # xml_type and xml_ns required on first node
  # will be checked when node_list is created
  
  # 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_s}
  @props[:path_should] = @props[:path_should].map{|v| v.to_s}

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

Instance Method Details

#path_is_now_to_typeObject



170
171
172
# File 'lib/puppet_x/vmware/mapper_nsx.rb', line 170

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