Commit ed743c18 authored by drumm's avatar drumm Committed by Neil Drumm

Centralize server name context writing

parent 85089670
......@@ -36,12 +36,6 @@ function db_drush_init($url = null) {
// this is where we generate the db service object.
}
function drush_db_provision_named_context_save() {
if (PROVISION_CONTEXT_SERVER) {
provision_service('db')->write_alias();
}
}
function db_drush_exit() {
// determine how to close it too.
provision_service('db')->close();
......@@ -309,12 +303,7 @@ class provisionService_db extends provisionService {
* Write out server's drushrc alias file.
*/
function write_alias() {
$config = new provisionConfig_drushrc_alias(array(
drush_get_option('hosting_name') . '-' . drush_get_option('init_db') => array(
'master_db',
),
));
$config->write();
return array(drush_get_option('init_db') => array('master_db'));
}
}
......
......@@ -25,12 +25,6 @@ function http_drush_init($url = null) {
}
}
function drush_http_provision_named_context_save() {
if (PROVISION_CONTEXT_SERVER) {
provision_service('http')->write_alias();
}
}
class provisionService_http extends provisionService {
/**
* Set defaults
......@@ -128,14 +122,6 @@ class provisionService_http extends provisionService {
* Write out server's drushrc alias file.
*/
function write_alias() {
$config = new provisionConfig_drushrc_alias(array(
drush_get_option('hosting_name') . '-' . drush_get_option('init_http') => array(
'web_host',
'web_ports',
'web_group',
'restart_cmd',
),
));
$config->write();
return array(drush_get_option('init_http') => array('web_host', 'web_ports', 'web_group', 'restart_cmd'));
}
}
......@@ -167,7 +167,7 @@ class provisionConfig_drushrc_alias extends provisionConfig_drushrc {
}
function filename() {
return drush_get_option('alias-path', drush_server_home() . '/.drush/aliases/') . trim($this->data['aliasname'], '@');
return drush_get_option('alias-path', drush_server_home() . '/.drush/aliases/') . $this->data['aliasname'];
}
}
......
......@@ -201,15 +201,33 @@ function provision_drush_command() {
'example.com' => dt('The url of the site being migrated.')),
);
return $items;
}
function drush_provision_hostmaster_make($platform) {
drush_backend_invoke('make', array(dirname(__FILE__) . '/aegir.make', $platform));
}
function drush_http_provision_named_context_save() {
if (PROVISION_CONTEXT_SERVER) {
$parents = array();
$contexts = array(
drush_get_option('hosting_name') => array('parents'),
);
foreach (provision_service('all') as $service) {
foreach ($service->write_alias() as $key => $value) {
$parents[] = drush_get_option('hosting_name') . '-' . $key;
$contexts[drush_get_option('hosting_name') . '-' . $key] = $value;
}
}
drush_set_option('parents', '@' . implode(',@', $parents));
$config = new provisionConfig_drushrc_alias($contexts);
$config->write();
}
}
function _provision_default_restart_cmd() {
$command = '/usr/sbin/apachectl'; # a proper default for most of the world
foreach (explode(':', $_SERVER['PATH']) as $path) {
......
......@@ -82,11 +82,10 @@ class provisionService {
return $this;
}
}
function write_alias() {
}
}
class provisionService_null extends provisionService {
......
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