コード例 #1
0
ファイル: getStatus.php プロジェクト: nmistry/deployitron
<?php

include_once 'lib/functions.php';
$cookieValue = checkCookieExists("info");
$cookieValue = getCookieData($cookieValue);
$userName = $cookieValue['userName'];
$authKey = $cookieValue['authKey'];
$cookieValue = checkCookieExists("serverdetails");
$serverInfo = getCookieData($cookieValue);
$cookieValue = checkCookieExists("apidetails");
$cookieValue = getCookieData($cookieValue);
$auth = new RackAuth($userName, $authKey);
$auth->setXAuthToken($cookieValue['XAuthToken']);
$auth->setXStorageToken($cookieValue['XStorageToken']);
$auth->setXStorageUrl($cookieValue['XStorageUrl']);
$auth->setXServerManagementUrl($cookieValue['XServerManagementUrl']);
$auth->setXCDNManagementURL($cookieValue['XCDNManagementUrl']);
ob_start();
if (empty($cookieValue['XStorageToken']) || !isset($serverInfo)) {
    $invalid = array("server" => array("progress" => "0", "status" => 'Could not get server details. Please <a href="/">try again.</a>'));
    echo json_encode($invalid);
    exit(1);
}
$cloudServers = new RackCloudService($auth);
$serverDetails = $cloudServers->listServer($serverInfo['serverID']);
$serverDetails = object2array($serverDetails);
echo json_encode($serverDetails);
flush_buffers();
コード例 #2
0
ファイル: kick.php プロジェクト: nmistry/deployitron
include_once 'lib/functions.php';
$cookieValue = checkCookieExists("info");
$cookieValue = getCookieData($cookieValue);
$userName = $cookieValue['userName'];
$authKey = $cookieValue['authKey'];
$software = $cookieValue['software'];
$cookieValue = checkCookieExists("apidetails");
$cookieValue = getCookieData($cookieValue);
$auth = new RackAuth($userName, $authKey);
$auth->setXAuthToken($cookieValue['XAuthToken']);
$auth->setXStorageToken($cookieValue['XStorageToken']);
$auth->setXStorageUrl($cookieValue['XStorageUrl']);
$auth->setXServerManagementUrl($cookieValue['XServerManagementUrl']);
$auth->setXCDNManagementURL($cookieValue['XCDNManagementUrl']);
$cloudServers = new RackCloudService($auth);
$serverName = $_POST['serverName'];
$imageID = $_POST['imageID'];
$flavorID = $_POST['flavorID'];
settype($imageID, "integer");
settype($flavorID, "integer");
$newServer = $cloudServers->createServer($serverName, $imageID, $flavorID, array("Description" => "Deployed by http://deployitron.com"));
$lastHTTPCode = Request::getLastHTTPCode();
$lastErrorMessage = Request::getLastError();
if ($lastHTTPCode != 202) {
    include 'header2.php';
    print "There was a problem creating the image. Maybe you should try a different image name. Please <a href=\"javascript: history.go(-1)\">try again</a>.";
    include 'footer.php';
    exit(1);
}
$newServer = object2array($newServer);