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