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