diff --git a/console/master/dropper b/console/master/dropper index 57eb2e6..737f3d6 100755 --- a/console/master/dropper +++ b/console/master/dropper @@ -59,22 +59,23 @@ def api_request(parameters, method="GET"): querystring = urllib.urlencode(parameters) req = urllib2.Request(endpoint + "?" + querystring) response = urllib2.urlopen(req) - return json.loads(response.read()) + result = response.read() + return json.loads(result) def show_list(): print "" for key, vps in vpsmap.items(): - node = nodemap[vps['NodeId']] - print "%s. %s (%s [%s], %s)" % (key, vps['Hostname'], node['Name'], node['Hostname'], node['PhysicalLocation']) + node = nodemap[vps['node_id']] + print "%s. %s (%s [%s], %s)" % (key, vps['hostname'], node['name'], node['hostname'], node['physical_location']) print "" choice = raw_input("Make your choice: ") try: current_vps = vpsmap[int(choice)] - current_node = nodemap[current_vps['NodeId']] + current_node = nodemap[current_vps['node_id']] - open_shell(current_node['Hostname'], "vz", current_vps['InternalId']) + open_shell(current_node['hostname'], "vz", current_vps['internal_id']) except KeyError, ValueError: print "That was not a valid option. Try again. " show_list() @@ -114,8 +115,8 @@ if auth_result['data']['correct'] == True: for vps in vpslist["data"]: vpsmap[i] = vps - if vps["NodeId"] not in nodelist: - nodelist.append(vps["NodeId"]) + if vps["node_id"] not in nodelist: + nodelist.append(vps["node_id"]) i += 1 diff --git a/frontend/api.local.php b/frontend/api.local.php index bf8ab43..f2d646a 100644 --- a/frontend/api.local.php +++ b/frontend/api.local.php @@ -66,13 +66,17 @@ if(isset($_GET['key']) && $_GET['key'] == $settings['local_api_key']) if($result = mysql_query_cached($query)) { - // TODO: output results $sContainers = array(); foreach($result->data as $row) { $sContainer = new Container($row); - $sContainers[] = $sContainer->Export(); + $sContainers[] = array( + 'hostname' => $sContainer->sHostname, + 'internal_id' => $sContainer->sInternalId, + 'node_id' => $sContainer->sNodeId, + 'status' => $sContainer->sStatus + ); } $return_object = $sContainers; @@ -88,7 +92,16 @@ if(isset($_GET['key']) && $_GET['key'] == $settings['local_api_key']) try { $sNode = new Node($_GET['nodeid']); - $return_object = $sNode->Export(); + $return_object = array( + 'name' => $sNode->sName, + 'hostname' => $sNode->sHostname, + 'port' => $sNode->sPort, + 'user' => $sNode->sUser, + 'physical_location' => $sNode->sPhysicalLocation, + 'private_key' => $sNode->sPrivateKey, + 'public_key' => $sNode->sPublicKey, + 'has_custom_key' => $sNode->sHasCustomKey + ); } catch (NotFoundException $e) { diff --git a/frontend/classes/class.container.php b/frontend/classes/class.container.php index d3434d7..570a61c 100644 --- a/frontend/classes/class.container.php +++ b/frontend/classes/class.container.php @@ -54,13 +54,6 @@ class Container extends CPHPDatabaseRecordClass ) ); - public $prototype_export = array( - 'Hostname', - 'InternalId', - 'NodeId', - 'Status' - ); - public function __get($name) { switch($name) diff --git a/frontend/classes/class.node.php b/frontend/classes/class.node.php index ac9f78e..14ca457 100644 --- a/frontend/classes/class.node.php +++ b/frontend/classes/class.node.php @@ -36,17 +36,6 @@ class Node extends CPHPDatabaseRecordClass ) ); - public $prototype_export = array( - 'Name', - 'Hostname', - 'Port', - 'User', - 'PhysicalLocation', - 'PrivateKey', - 'PublicKey', - 'HasCustomkey' - ); - public $ssh = null; protected function EventConstructed()