Commit b65d278d authored by anarcat's avatar anarcat Committed by anarcat

take the db server from the hostmaster site

this completes the implementation of installs on the frontend, which now correctly creates a db server node if it's different.

i haven't tested the non-remote db server case yet, i assume it still works
parent 375aeb4f
......@@ -81,8 +81,11 @@ function hostmaster_bootstrap() {
'available' => 1,
));
/* examine the db server associated with the hostmaster site */
$db_server = d()->db_server;
$master_db = parse_url(d()->platform->server->master_db);
$master_db = parse_url($db_server->master_db);
/* if it's not the same server as the master server, create a new node
* for it */
if ($db_server->remote_host == $master_server->remote_host) {
$db_node = $node;
} else {
......@@ -94,7 +97,7 @@ function hostmaster_bootstrap() {
$db_node->hosting_name = 'server_' . $db_server->remote_host;
$db_node->services = array();
}
hosting_services_add($db_node, 'db', d()->platform->server->db_service_type, array(
hosting_services_add($db_node, 'db', $db_server->db_service_type, array(
'db_type' => $master_db['scheme'],
'db_user' => $master_db['user'],
'db_passwd' => $master_db['pass'],
......@@ -102,16 +105,17 @@ function hostmaster_bootstrap() {
'available' => 1,
));
drupal_set_message('creating master server node');
node_save($node);
if ($db_server->remote_host != $master_server->remote_host) {
drupal_set_message('creating db server node');
node_save($db_node);
}
variable_set('hosting_default_web_server', $node->nid);
variable_set('hosting_own_web_server', $node->nid);
$db_server = $node->nid;
variable_set('hosting_default_db_server', $node->nid);
variable_set('hosting_own_db_server', $node->nid);
variable_set('hosting_default_db_server', $db_node->nid);
variable_set('hosting_own_db_server', $db_node->nid);
$node = new stdClass();
$node->uid = 1;
......@@ -162,7 +166,7 @@ function hostmaster_bootstrap() {
$node->title = d()->uri;
$node->platform = $platform_id;
$node->client = $client_id;
$node->db_server = $db_server;
$node->db_server = $db_node->nid;
$node->profile = $profile_id;
$node->import = true;
$node->hosting_name = 'hostmaster';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment