From 9ae6f5539aee1e7a79acbad2163416a094c9d927 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 31 Mar 2016 18:17:42 +0200 Subject: [PATCH] KickstartHelper: get has no default value support --- library/Director/KickstartHelper.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/library/Director/KickstartHelper.php b/library/Director/KickstartHelper.php index d6c66ef3..55377636 100644 --- a/library/Director/KickstartHelper.php +++ b/library/Director/KickstartHelper.php @@ -229,10 +229,17 @@ class KickstartHelper ); } + $ep = $this->deploymentEndpoint; + + $epHost = $ep->get('host'); + if (!$epHost) { + $epHost = $ep->object_name; + } + try { $this->switchToDeploymentApi()->getStatus(); } catch (Exception $e) { - $ep = $this->deploymentEndpoint; + throw new ConfigurationError( 'I was unable to re-establish a connection to the Endpoint "%s" (%s:%d).' . ' When reconnecting to the configured Endpoint (%s:%d) I get an error: %s' @@ -240,7 +247,7 @@ class KickstartHelper $master, $this->getHost(), $this->getPort(), - $ep->get('host', $ep->object_name), + $epHost, $ep->get('port'), $e->getMessage() ); @@ -303,8 +310,13 @@ class KickstartHelper unset($this->api); $ep = $this->deploymentEndpoint; + $epHost = $ep->get('host'); + if (!$epHost) { + $epHost = $ep->object_name; + } + $client = new RestApiClient( - $ep->get('host', $ep->object_name), + $epHost, $ep->get('port') );