Method: Puppet::Provider::NameService::DirectoryService#ensure=

Defined in:
lib/puppet/provider/nameservice/directoryservice.rb

#ensure=(ensure_value) ⇒ Object



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/puppet/provider/nameservice/directoryservice.rb', line 310

def ensure=(ensure_value)
  super
  # We need to loop over all valid properties for the type we're
  # managing and call the method which sets that property value
  # dscl can't create everything at once unfortunately.
  if ensure_value == :present
    @resource.class.validproperties.each do |name|
      next if name == :ensure

      # LAK: We use property.sync here rather than directly calling
      # the settor method because the properties might do some kind
      # of conversion.  In particular, the user gid property might
      # have a string and need to convert it to a number
      if @resource.should(name)
        @resource.property(name).sync
      else
        value = autogen(name)
        if value
          send(name.to_s + "=", value)
        else
          next
        end
      end
    end
  end
end