protected function setUp()
 {
     parent::setUp();
     $this->_onapp_config = $this->getConfig();
     $obj = new OnApp_VirtualMachine();
     $obj->auth($this->_onapp_config['hostname'], $this->_onapp_config['username'], $this->_onapp_config['password']);
     $list = $obj->getList();
     $this->fixture = $list[0]->_id;
 }
Ejemplo n.º 2
0
// Check VM access
$sql = sprintf("SELECT \n        service_id \n    FROM \n        tblonappservices \n        LEFT JOIN tblhosting ON tblhosting.id = service_id \n    WHERE \n        userid = '%s' \n        AND vm_id = '%s';", stripcslashes($user_id), stripcslashes($vm_id));
$sql_result = getSQLResult($sql);
if (!isset($sql_result["service_id"])) {
    die("Access denied to this Console");
} else {
    $service_id = $sql_result["service_id"];
}
unset($sql);
unset($sql_result);
// Load VM server id
$service = get_service($service_id);
$onapp_config = get_onapp_config($service['serverid']);
$user = get_onapp_client($service_id);
if (!$onapp_config) {
    die("Can't found active OnApp server #" . addslashes($server_id) . " in Data Base");
}
// Load VM
$vm = new OnApp_VirtualMachine();
$vm->auth($onapp_config["adress"], $user["email"], $user["password"]);
$vm->_id = $vm_id;
$vm->load();
// Load console
$console = new ONAPP_Console();
$console->auth($onapp_config["adress"], $user["email"], $user["password"]);
$console->load($vm_id);
$url = ($onapp_config["hostname"] ? $onapp_config["hostname"] : $onapp_config["adress"]) . "/console_remote/" . $console->_obj->_remote_key;
if (strpos($url, 'http') === false && strpos($url, 'http') === false) {
    $url = 'http://' . $url;
}
header("Location: {$url}");