Commit f126e6ce authored by ergonlogic's avatar ergonlogic

Issue #2031397: Add configurable context/alias names.

parent f707656b
......@@ -17,6 +17,7 @@ class Provision_Context_site extends Provision_Context {
'redirection' => 'site: boolean for whether --aliases should redirect; default false',
'client_name' => 'site: machine name of the client that owns this site',
'profile' => 'site: Drupal profile to use; default default',
'drush_aliases' => 'site: Comma-separated list of additional Drush aliases through which this site can be accessed.',
);
}
......@@ -35,8 +36,22 @@ class Provision_Context_site extends Provision_Context {
$this->setProperty('aliases', array(), TRUE);
$this->setProperty('redirection', FALSE);
$this->setProperty('cron_key', '');
$this->setProperty('drush_aliases', array(), TRUE);
// this can potentially be handled by a Drupal sub class
$this->setProperty('profile', 'default');
}
/**
* Write out this named context to an alias file.
*/
function write_alias() {
$config = new Provision_Config_Drushrc_Alias($this->name, $this->properties);
$config->write();
foreach ($this->drush_aliases as $drush_alias) {
$config = new Provision_Config_Drushrc_Alias($drush_alias, $this->properties);
$config->write();
}
}
}
......@@ -23,6 +23,12 @@ class Provision_Config_Http_Site extends Provision_Config_Http {
$this->aliases = array_filter($this->aliases, 'trim');
if ($this->drush_aliases && !is_array($this->drush_aliases)) {
$this->drush_aliases = explode(",", $this->drush_aliases);
}
$this->drush_aliases = array_filter($this->drush_aliases, 'trim');
if (!$this->site_enabled) {
$this->template = $this->disabled_template;
}
......
......@@ -234,6 +234,7 @@ function drush_provision_hostmaster_install($site = NULL) {
'uri' => $site,
'client_name' => drush_get_option('client_name'),
'profile' => $profile,
'drush_aliases' => 'hm',
));
$data = provision_backend_invoke($site_name, 'provision-install', array(), array('client_email' => drush_get_option('client_email')));
provision_backend_invoke($site_name, 'provision-verify');
......
......@@ -127,6 +127,7 @@ We are making the following assumptions:
'db_server' => $server,
'uri' => $site,
'profile' => 'hostmaster',
'drush_aliases' => 'hm',
));
provision_backend_invoke($site_name, 'provision-verify');
drush_set_option('site_name', $site_name);
......
......@@ -21,6 +21,9 @@ function drush_provision_drupal_provision_delete() {
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_ROOT);
drush_invoke_process('@none', 'provision-save', array(d()->name), array('delete' => TRUE));
foreach (d()->drush_aliases as $alias) {
drush_invoke_process('@none', 'provision-save', array($alias), array('delete' => TRUE));
}
// Do not automatically save the drushrc at the end of the command.
drush_set_option('provision_save_config', false);
......
......@@ -37,6 +37,11 @@ function drush_provision_drupal_pre_provision_install() {
function drush_provision_drupal_pre_provision_install_rollback() {
_provision_recursive_delete( d()->site_path );
drush_invoke_process('@none', 'provision-save', array(d()->name), array('delete' => TRUE));
foreach (d()->drush_aliases as $alias) {
drush_invoke_process('@none', 'provision-save', array($alias), array('delete' => TRUE));
}
}
......
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