From 2d260aa6f591030f869063ccdb1f6997d12c1294 Mon Sep 17 00:00:00 2001 From: Yoggzo Date: Tue, 19 Apr 2016 17:17:14 +0200 Subject: correct syntaxt on Network, add tests for automating --- server/core/FloatingIp.php | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'server/core/FloatingIp.php') diff --git a/server/core/FloatingIp.php b/server/core/FloatingIp.php index 4271a84..c5a947e 100755 --- a/server/core/FloatingIp.php +++ b/server/core/FloatingIp.php @@ -105,7 +105,16 @@ class floatingIp implements Core{ $this->app->setOutput("Error", "Incorrect parameter opt"); } try{ - $floatingip = null; //obtenir ip + $floatingips = listFloatingIps(); + $floatingIp = null; + foreach ($floatingips as $f) { + if($f['id'] == $id){ + $floatingIp = $f; + } + } + if(!isset($floatingIp)){ + $this->app->setOutput("Error", "Unknowing floatingip id"); + } $floatingip->update(); @@ -139,7 +148,16 @@ class floatingIp implements Core{ $this->app->setOutput("Error", "Incorrect parameter opt"); } try{ - $floatingip = null; //obtenir ip + $floatingips = listFloatingIps(); + $floatingIp = null; + foreach ($floatingips as $f) { + if($f['id'] == $id){ + $floatingIp = $f; + } + } + if(!isset($floatingIp)){ + $this->app->setOutput("Error", "Unknowing floatingip id"); + } $floatingip->delete(); @@ -173,7 +191,16 @@ class floatingIp implements Core{ $this->app->setOutput("Error", "Incorrect parameter opt"); } try{ - $floatingip = null; //obtenir ip + $floatingips = listFloatingIps(); + $floatingIp = null; + foreach ($floatingips as $f) { + if($f['id'] == $id){ + $floatingIp = $f; + } + } + if(!isset($floatingIp)){ + $this->app->setOutput("Error", "Unknowing floatingip id"); + } $floatingip->retrieve(); -- cgit v1.2.3