From 82f5126c34a881e05624b5407bbc0db2bc8e1517 Mon Sep 17 00:00:00 2001 From: sbyrd Date: Mon, 7 Dec 2020 16:50:41 -0500 Subject: [PATCH] roles --- image.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/image.php b/image.php index ee206bc..50b7263 100644 --- a/image.php +++ b/image.php @@ -11,8 +11,11 @@ class image extends objectStructs public $annotations; /** @var imageConfig */ public $config; - /** @var string name of image */ - public $image; + /** @var string name of hte image*/ + public $imageName; + /** @var string name of image after the registry domain -- /image:latest */ + public $shortName; + public function __construct($vars) { @@ -21,6 +24,16 @@ class image extends objectStructs $this->imageName = (isset($vars['image']) ? $vars['image'] : (isset($vars['name']) ? $vars['name'] : (isset($vars['imageName']) ? $vars['imageName'] : "" ) ) ) ; + + if (empty($this->imageName)) + throw new \Exception(__FUNCTION__ . " Image name is empty"); + + list($RegistryDomain, $ImageShortName) = explode('/',$this->imageName,2); + if (!$ImageShortName) + throw new \Exception(__FUNCTION__ . " Image short name not valid"); + else + $this->shortName = $ImageShortName; + if (isset( $vars['imageBasic']->annotations) ) $annotations = $vars['imageBasic']->annotations; elseif (isset($vars['annotations']))