From a14920641852c682fc3d58c83f4e86ad458db14d Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 17 Mar 2016 01:12:46 +0100 Subject: [PATCH] ObjectCommand: allow experimental live creation --- library/Director/Cli/ObjectCommand.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/library/Director/Cli/ObjectCommand.php b/library/Director/Cli/ObjectCommand.php index 14eedf23..f4c6d2be 100644 --- a/library/Director/Cli/ObjectCommand.php +++ b/library/Director/Cli/ObjectCommand.php @@ -120,6 +120,25 @@ class ObjectCommand extends Command if ($object->store()) { printf("%s '%s' has been created\n", $type, $name); + if ($this->hasExperimental('live-creation')) { + if ($this->api()->createObjectAtRuntime($object)) { + echo "Live creation for '$name' succeeded\n"; + } else { + echo "Live creation for '$name' succeeded\n"; + exit(1); + } + + if ($type === 'Host' && $this->hasExperimental('immediate-check')) { + echo "Waiting for check result..."; + flush(); + if ($res = $this->api()->checkHostAndWaitForResult($name)) { + echo " done\n" . $res->output . "\n"; + } else { + echo "TIMEOUT\n"; + } + } + } + exit(0); } else { printf("%s '%s' has not been created\n", $type, $name);