Method: Puppet::Provider::Ldap#initialize
- Defined in:
- lib/puppet/provider/ldap.rb
#initialize(*args) ⇒ Ldap
Returns a new instance of Ldap.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/puppet/provider/ldap.rb', line 81 def initialize(*args) raise(Puppet::DevError, _("No LDAP Configuration defined for %{class_name}") % { class_name: self.class }) unless self.class.manager raise(Puppet::DevError, _("Invalid LDAP Configuration defined for %{class_name}") % { class_name: self.class }) unless self.class.manager.valid? super @property_hash = @property_hash.each_with_object({}) do |ary, result| param, values = ary # Skip any attributes we don't manage. next result unless self.class.resource_type.valid_parameter?(param) paramclass = self.class.resource_type.attrclass(param) unless values.is_a?(Array) result[param] = values next result end # Only use the first value if the attribute class doesn't manage # arrays of values. if paramclass.superclass == Puppet::Parameter or paramclass.array_matching == :first result[param] = values[0] else result[param] = values end end # Make a duplicate, so that we have a copy for comparison # at the end. @ldap_properties = @property_hash.dup end |