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

Cleanup work focusing on making sure extrnal servers are working.

parent 1b8cf5de
......@@ -14,13 +14,3 @@ function drush_db_provision_verify() {
provision_service('db')->verify();
}
}
function drush_db_post_provision_verify() {
if (PROVISION_CONTEXT_PLATFORM) {
drush_unset_option('master_db', 'drupal');
}
if (PROVISION_CONTEXT_SERVER) {
drush_set_option('master_db', drush_get_option('master_db'), 'user');
}
}
......@@ -37,12 +37,9 @@ class provisionService_http_apache extends provisionService_http {
return $config->unlink();
}
function verify() {
if (PROVISION_CONTEXT_PLATFORM) {
if (drush_get_option('platform', null)) {
$this->create_platform_config();
}
$this->create_platform_config();
}
elseif (PROVISION_CONTEXT_SERVER) {
provision_service('file')->create_dir(drush_get_option('vhost_path'), dt("Virtual host configuration"), 0700);
......@@ -105,7 +102,7 @@ class provisionConfig_apache_platform extends provisionConfig_apache {
public $description = 'apache platform configuration file';
function filename() {
return $this->data['platform_conf_path'] . '/platform_' . $this->data['platform'] . '.conf';
return $this->data['platform_conf_path'] . '/platform_' . $this->data['platform-name'] . '.conf';
}
function process() {
......
......@@ -3,29 +3,3 @@
function drush_http_provision_verify() {
provision_service('http')->verify();
}
function drush_http_post_provision_verify() {
if (PROVISION_CONTEXT_PLATFORM) {
drush_set_option('publish_path', realpath(drush_get_option('publish_path')), 'drupal');
drush_unset_option('master_url', 'drupal');
drush_unset_option('web_host', 'drupal');
drush_unset_option('web_ip', 'drupal');
drush_unset_option('web_group', 'drupal');
drush_unset_option('script_user', 'drupal');
drush_unset_option('restart_cmd', 'drupal');
drush_unset_option('backup_path', 'drupal');
drush_unset_option('config_path', 'drupal');
}
elseif (PROVISION_CONTEXT_SERVER) {
drush_log("saving settings in the server context");
drush_set_option('master_url', drush_get_option('master_url'), 'user');
drush_set_option('web_host', drush_get_option('web_host', '127.0.0.1'), 'user');
drush_set_option('web_ip', drush_get_option('web_ip', ''), 'user');
drush_set_option('web_port', drush_get_option('web_port', 80), 'user');
drush_set_option('web_group', drush_get_option('web_group'), 'user');
drush_set_option('script_user', drush_get_option('script_user'), 'user');
drush_set_option('restart_cmd', drush_get_option('restart_cmd', _provision_default_restart_cmd(), 'user'), 'user');
drush_set_option('backup_path', drush_get_option('backup_path'), 'user');
drush_set_option('config_path', drush_get_option('config_path'), 'user');
}
}
......@@ -5,6 +5,7 @@
*/
function drush_provision_hostmaster_install($site) {
drush_set_option('alias-path', drush_server_home() . '/.drush/aliases');
if (!$site) {
return drush_set_error('SITE_MISSING', dt('You need to specify the FQDN of the hostmaster install'));
}
......@@ -36,7 +37,8 @@ function drush_provision_hostmaster_install($site) {
print "\n"; # add a cr since the user's didn't echo
$data['master_db'] = "$scheme://$user:$pass@$host";
}
$data['hosting_name'] = 'server_localhost';
$data['provision-service-http'] = 'apache';
$data['provision-service-db'] = 'mysql';
$data['provision-context'] = 'server';
......@@ -49,26 +51,27 @@ function drush_provision_hostmaster_install($site) {
$data['drush_path'] = DRUSH_COMMAND;
// verify the server
drush_backend_invoke('provision-verify', $data, 'POST');
drush_backend_invoke('provision-named-context-save', $data, 'POST');
drush_do_site_command(drush_sitealias_get_record('@server_localhost'), 'provision-verify');
if (drush_get_option('backend-only')) {
return;
}
// verify the current platform
drush_backend_invoke('provision-verify', array(
drush_backend_invoke('provision-named-context-save', array(
'parent' => '@server_localhost-apache', // todo should match future node title
'hosting_name' => 'platform_Hostmaster', // todo should match future node title
'provision-context' => 'platform',
'root' => $platform,
'provision-context' => "platform",
'publish_path' => $platform,
'platform' => '5') // dirty hardcoded to create the first platform apache config
// this will become unnecessary when we have drush aliases
);
));
drush_do_site_command(drush_sitealias_get_record('@platform_Hostmaster'), 'provision-verify');
// install the hostmaster site
$data = drush_backend_invoke('provision-install', array(
$site,
'hosting_name' => '',//todo
'parent' => '@server_localhost-mysql,@platform_Hostmaster',
'uri' => $site,
'root' => $platform,
'client_email' => drush_get_option('client_email', 'webmaster@localhost'),
'profile' => "hostmaster",
'provision-context' => "site",
......
......@@ -122,9 +122,6 @@ function provision_drupal_drush_exit() {
provision_save_platform_data();
}
}
elseif (PROVISION_CONTEXT_SERVER) {
provision_save_server_data();
}
}
}
......
......@@ -171,14 +171,6 @@ class provisionConfig_drushrc_alias extends provisionConfig_drushrc {
}
}
/**
* Server level config for drushrc.php files.
*/
class provisionConfig_drushrc_server extends provisionConfig_drushrc {
protected $context_name = 'user';
public $description = 'Server drush configuration';
}
/**
* Class for writing $platform/drushrc.php files.
*/
......
......@@ -221,17 +221,16 @@ function drush_http_provision_named_context_save() {
}
drush_set_option('parent', '@' . implode(',@', $parents));
$config = new provisionConfig_drushrc_alias(array(drush_get_option('hosting_name') => array('parent', 'provision-context')));
$config = new provisionConfig_drushrc_alias(array(drush_get_option('hosting_name') => array('parent', 'provision-context', 'config_path', 'backup_path')));
$config->write();
}
elseif (PROVISION_CONTEXT_PLATFORM) {
$config = new provisionConfig_drushrc_alias(array(drush_get_option('hosting_name') => array('parent', 'provision-context', 'publish_path')));
drush_set_option('platform-name', preg_replace('/^platform_/', '', drush_get_option('hosting_name')));
$config = new provisionConfig_drushrc_alias(array(drush_get_option('hosting_name') => array('parent', 'provision-context', 'root', 'platform-name')));
$config->write();
}
elseif (PROVISION_CONTEXT_SITE) {
drush_set_option('uri', drush_get_option('provision-uri'));
drush_set_option('root', drush_get_option('publish_path'));
$config = new provisionConfig_drushrc_alias(array(drush_get_option('hosting_name') => array('parent', 'provision-context', 'root', 'uri', 'site_port', 'site_id', 'language')));
$config = new provisionConfig_drushrc_alias(array(drush_get_option('hosting_name') => array('parent', 'provision-context', 'uri', 'site_port', 'site_id', 'language', 'client_email')));
$config->write();
}
}
......
......@@ -47,16 +47,6 @@ function provision_save_platform_data() {
}
}
/**
* Save modified options to the drushrc.php file
*/
function provision_save_server_data() {
if (!drush_get_error()) {
$config = new provisionConfig_drushrc_server();
$config->write();
}
}
/**
* @} End of "defgroup sitedata".
*/
......
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