Method: Puppet::Provider::AixObject#set

Defined in:
lib/puppet/provider/aixobject.rb

#set(param, value) ⇒ Object

Set a property.



363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/puppet/provider/aixobject.rb', line 363

def set(param, value)
  @property_hash[param.intern] = value

  if getinfo().nil?
    # This is weird...
    raise Puppet::Error, _("Trying to update parameter '%{param}' to '%{value}' for a resource that does not exists %{resource} %{name}: %{detail}") % { param: param, value: value, resource: @resource.class.name, name: @resource.name, detail: detail }
  end
  if value == getinfo()[param.to_sym]
    return
  end

  #self.class.validate(param, value)
  if cmd = modifycmd({param =>value})
    begin
      execute(cmd)
    rescue Puppet::ExecutionFailure  => detail
      raise Puppet::Error, _("Could not set %{param} on %{resource}[%{name}]: %{detail}") % { param: param, resource: @resource.class.name, name: @resource.name, detail: detail }, detail.backtrace
    end
  end

  # Refresh de info.
  getinfo(true)
end