Method: Puppet::Provider::Nsx#ensure_array

Defined in:
lib/puppet/provider/nsx.rb

#ensure_array(value) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/puppet/provider/nsx.rb', line 96

def ensure_array(value)
  # Ensure results an array. If there's a single value the result is a hash, while multiple results in an array.
  case value
  when nil
    []
  when Array
    value
  when Hash
    [value]
  when Nori::StringWithAttributes
    [value]
  else
    raise Puppet::Error, "Unknown type for munging #{value.class}: '#{value}'"
  end
end