Method: Puppet::Provider::NameService::DirectoryService#set

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

#set(param, value) ⇒ Object

NBK: we override @parent.set as we need to execute a series of commands to deal with array values, rather than the single command nameservice.rb expects to be returned by modifycmd. Thus we don’t bother defining modifycmd.



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/puppet/provider/nameservice/directoryservice.rb', line 357

def set(param, value)
  self.class.validate(param, value)
  current_members = @property_value_cache_hash[:members]
  if param == :members
    # If we are meant to be authoritative for the group membership
    # then remove all existing members who haven't been specified
    # in the manifest.
    remove_unwanted_members(current_members, value) if @resource[:auth_membership] and !current_members.nil?

    # if they're not a member, make them one.
    add_members(current_members, value)
  else
    exec_arg_vector = self.class.get_exec_preamble("-create", @resource[:name])
    # JJM: The following line just maps the NS name to the DS name
    #      e.g. { :uid => 'UniqueID' }
    exec_arg_vector << ns_to_ds_attribute_map[param.intern]
    # JJM: The following line sends the actual value to set the property to
    exec_arg_vector << value.to_s
    begin
      execute(exec_arg_vector)
    rescue Puppet::ExecutionFailure => detail
      fail(_("Could not set %{param} on %{resource}[%{name}]: %{detail}") % { param: param, resource: @resource.class.name, name: @resource.name, detail: detail })
    end
  end
end