Modifications in error management and correct error in Image.php
This commit is contained in:
parent
dcf0d8b2ba
commit
e9c7477ff0
5 changed files with 124 additions and 39 deletions
|
@ -89,9 +89,11 @@ class AppTest{
|
|||
}
|
||||
|
||||
public function getPostParam($name){
|
||||
|
||||
return $this->postParams[$name];
|
||||
|
||||
if(isset($this->postParams[$name])){
|
||||
return $this->postParams[$name];
|
||||
}else{
|
||||
$this->setOutput("Error", "Missing parameter ".$name);
|
||||
}
|
||||
}
|
||||
|
||||
public function setPostParam($name, $value){
|
||||
|
|
|
@ -6,6 +6,9 @@ include_once("../core/Compute.php");
|
|||
$image = new Image($App);
|
||||
$compute = new Compute($App);
|
||||
|
||||
// Création image
|
||||
/*
|
||||
echo "Création image :</br>";
|
||||
$opt = Array();
|
||||
$opt['name'] = "Test";
|
||||
$opt['tags'] = ['test', 'openstack'];
|
||||
|
@ -16,28 +19,86 @@ $opt['minDisk'] = 1;
|
|||
$opt['protected'] = false;
|
||||
$opt['minRam'] = 10;
|
||||
|
||||
//$App->setPostParam('id', 'sdfihlus154dfhj');
|
||||
//$err = $image->action("createImage");
|
||||
$App->setPostParam('opt', $opt);
|
||||
$image->action("createImage");
|
||||
$retCreate = json_decode($App->show(), true)["Images"];
|
||||
$idNew = $retCreate['id'];
|
||||
*/
|
||||
|
||||
/*
|
||||
// Delete Image
|
||||
$App->setPostParam('id', $idNew);
|
||||
$image->action("deleteImage");
|
||||
*/
|
||||
|
||||
//Liste des images
|
||||
// Liste images
|
||||
$image->action("listImage");
|
||||
$im = $App->show();
|
||||
$images = json_decode($im, true)["Images"];
|
||||
|
||||
echo "Images présentes :";
|
||||
echo "</br>";
|
||||
echo "List images :</br>";
|
||||
foreach($images as $i){
|
||||
$recup = $i;
|
||||
echo $recup['name'];
|
||||
echo $i['name']."</br>"; // Nom
|
||||
echo $i['status']."</br>"; // Status
|
||||
$id = $i['id']; // Id
|
||||
echo $id."</br>";
|
||||
foreach ($i['tags'] as $tag) { // Tags
|
||||
echo $tag."</br>";
|
||||
}
|
||||
echo "</br>";
|
||||
//echo $recup['id'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Details images
|
||||
echo "Détail image :</br>";
|
||||
$App->setPostParam('id', $id);
|
||||
$image->action("detailsImage");
|
||||
$retDetails = json_decode($App->show(), true)["Images"];
|
||||
echo $retDetails['id']."</br>";
|
||||
echo "</br>";
|
||||
|
||||
|
||||
/*
|
||||
// Download image
|
||||
$App->setPostParam('id', $id);
|
||||
$image->action("downloadImage");
|
||||
*/
|
||||
|
||||
|
||||
// Desactivate Images
|
||||
echo "Desactivate image : </br>";
|
||||
echo $id."</br>";
|
||||
$App->setPostParam('id', $id);
|
||||
$err = $image->action("desactivateImage");
|
||||
echo "</br>";
|
||||
|
||||
|
||||
/*
|
||||
// Resactivate Images
|
||||
echo $id."</br>";
|
||||
$App->setPostParam('id', $id);
|
||||
$err = $image->action("resactivateImage");
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// Details images
|
||||
echo "Update image :</br>";
|
||||
$optUpdate = Array();
|
||||
$optUpdate['tags'] = ['ciros', 'testUpdate'];
|
||||
$App->setPostParam('id', $id);
|
||||
$App->setPostParam('opt', $optUpdate);
|
||||
$image->action("updateImage");
|
||||
$retDetails = json_decode($App->show(), true)["Images"];
|
||||
foreach ($retDetails['tags'] as $tag) { // Tags
|
||||
echo $tag."</br>";
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
echo "Flavors: ";
|
||||
echo "</br>";
|
||||
|
||||
$compute->action("listFlavors");
|
||||
$flavors = json_decode($App->show(), true)["Flavors"];
|
||||
|
||||
|
@ -49,17 +110,5 @@ foreach($flavors as $f){
|
|||
echo "vcpus=".$f['vcpus'];
|
||||
echo "</br>";
|
||||
}
|
||||
|
||||
/*
|
||||
$App->setPostParam('id', 354);
|
||||
$err = $image->action("deleteImage");
|
||||
$temp = $App->show();
|
||||
$ret = json_decode($temp, true)["Images"];
|
||||
echo $ret['id'];
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue