IcingaCommandArgumentForm: store command, not args

refs #11536
This commit is contained in:
Thomas Gelf 2016-08-01 10:45:47 +00:00
parent 6258230fdb
commit 52e412002f
2 changed files with 11 additions and 4 deletions

View File

@ -116,7 +116,7 @@ class IcingaCommandArgumentForm extends DirectorObjectForm
$this->translate('The argument %s has successfully been stored'), $this->translate('The argument %s has successfully been stored'),
$object->argument_name $object->argument_name
); );
$object->store($this->db); $cmd->store($this->db);
} else { } else {
$this->setHttpResponseCode(304); $this->setHttpResponseCode(304);
$msg = $this->translate('No action taken, object has not been modified'); $msg = $this->translate('No action taken, object has not been modified');

View File

@ -82,9 +82,16 @@ class IcingaArguments implements Iterator, Countable, IcingaConfigRenderer
public function set($key, $value) public function set($key, $value)
{ {
$argument = IcingaCommandArgument::create( if ($value instanceof IcingaCommandArgument) {
$this->mungeCommandArgument($key, $value) $argument = $value;
)->set('command_id', $this->object->id); } else {
$argument = IcingaCommandArgument::create(
$this->mungeCommandArgument($key, $value)
);
}
$argument->set('command_id', $this->object->id);
$key = $argument->argument_name; $key = $argument->argument_name;
if (array_key_exists($key, $this->arguments)) { if (array_key_exists($key, $this->arguments)) {
$this->arguments[$key]->replaceWith($argument); $this->arguments[$key]->replaceWith($argument);