diff --git a/library/Director/Cli/ObjectCommand.php b/library/Director/Cli/ObjectCommand.php index 26de5e4a..544492c0 100644 --- a/library/Director/Cli/ObjectCommand.php +++ b/library/Director/Cli/ObjectCommand.php @@ -141,10 +141,11 @@ class ObjectCommand extends Command } else { $props['object_name'] = $name; } - } - - if (! array_key_exists('object_name', $props)) { - $this->fail('Cannot create an object with at least an object name'); + } else { + if (! array_key_exists('object_name', $props)) { + $this->fail('Cannot create an object with at least an object name'); + } + $name = $props['object_name']; } $object = IcingaObject::createByType(