# File lib/puppet/provider/nameservice/directoryservice.rb, line 396
396:   def create
397:     if exists?
398:       info "already exists"
399:       return nil
400:     end
401: 
402:     # NBK: First we create the object with a known guid so we can set the contents
403:     # of the password hash if required
404:     # Shelling out sucks, but for a single use case it doesn't seem worth
405:     # requiring people install a UUID library that doesn't come with the system.
406:     # This should be revisited if Puppet starts managing UUIDs for other platform
407:     # user records.
408:     guid = %x{/usr/bin/uuidgen}.chomp
409: 
410:     exec_arg_vector = self.class.get_exec_preamble("-create", @resource[:name])
411:     exec_arg_vector << @@ns_to_ds_attribute_map[:guid] << guid
412:     begin
413:       execute(exec_arg_vector)
414:     rescue Puppet::ExecutionFailure => detail
415:       fail("Could not set GeneratedUID for #{@resource.class.name} #{@resource.name}: #{detail}")
416:     end
417: 
418:     if value = @resource.should(:password) and value != ""
419:       self.class.set_password(@resource[:name], guid, value)
420:     end
421: 
422:     # Now we create all the standard properties
423:     Puppet::Type.type(@resource.class.name).validproperties.each do |property|
424:       next if property == :ensure
425:       if value = @resource.should(property) and value != ""
426:         if property == :members
427:           add_members(nil, value)
428:         else
429:           exec_arg_vector = self.class.get_exec_preamble("-create", @resource[:name])
430:           exec_arg_vector << @@ns_to_ds_attribute_map[symbolize(property)]
431:           next if property == :password  # skip setting the password here
432:           exec_arg_vector << value.to_s
433:           begin
434:             execute(exec_arg_vector)
435:           rescue Puppet::ExecutionFailure => detail
436:             fail("Could not create #{@resource.class.name} #{@resource.name}: #{detail}")
437:           end
438:         end
439:       end
440:     end
441:   end