Commit b5851a3b authored by Jon Pugh's avatar Jon Pugh Committed by GitHub

Merge pull request #10 from aegir-project/2826388-check-hostmaster

Issue #2826388 check hostmaster using root and uri comparison.
parents 428bf48f 07e9a918
...@@ -80,7 +80,7 @@ function drush_provision_drupal_provision_migrate($platform, $new_name = NULL) { ...@@ -80,7 +80,7 @@ function drush_provision_drupal_provision_migrate($platform, $new_name = NULL) {
// If the site is migrated between platforms and not just renamed, // If the site is migrated between platforms and not just renamed,
// we should update the info collected about source and target platform first. // we should update the info collected about source and target platform first.
// Note that we have to exclude Hostmaster platform from this extra verify. // Note that we have to exclude Hostmaster platform from this extra verify.
if (d()->profile != 'hostmaster') { if (!provision_is_hostmaster_site()) {
if (!is_null(d($platform)->name) && (d($platform)->name != d()->platform->name)) { if (!is_null(d($platform)->name) && (d($platform)->name != d()->platform->name)) {
provision_backend_invoke('@hostmaster', 'hosting-task', array(d()->platform->name, 'verify'), array('force' => TRUE)); provision_backend_invoke('@hostmaster', 'hosting-task', array(d()->platform->name, 'verify'), array('force' => TRUE));
sleep(5); // A small trick to avoid high load and race conditions. sleep(5); // A small trick to avoid high load and race conditions.
...@@ -136,7 +136,7 @@ function drush_provision_drupal_provision_migrate($platform, $new_name = NULL) { ...@@ -136,7 +136,7 @@ function drush_provision_drupal_provision_migrate($platform, $new_name = NULL) {
} }
else { else {
// We have to exclude Hostmaster site from any extra verify steps. // We have to exclude Hostmaster site from any extra verify steps.
if (d()->profile != 'hostmaster') { if (!provision_is_hostmaster_site()) {
// We should update also the info collected about the site before running migrate task. // We should update also the info collected about the site before running migrate task.
// Doing this is safe only when the site is migrated with the same name - see issue #1067702. // Doing this is safe only when the site is migrated with the same name - see issue #1067702.
$local_uri_verify = '@' . d()->uri; $local_uri_verify = '@' . d()->uri;
...@@ -219,7 +219,7 @@ function drush_provision_drupal_post_provision_migrate($platform, $new_name = NU ...@@ -219,7 +219,7 @@ function drush_provision_drupal_post_provision_migrate($platform, $new_name = NU
$rename_only = drush_get_option('rename_only'); $rename_only = drush_get_option('rename_only');
if ($rename_only) { if ($rename_only) {
// We run this extra tricky backend verify to avoid issue #1004526. // We run this extra tricky backend verify to avoid issue #1004526.
if (d()->profile != 'hostmaster') { if (!provision_is_hostmaster_site()) {
$deploy_replace_site = drush_get_option('deploy_replace_site'); $deploy_replace_site = drush_get_option('deploy_replace_site');
$final_aliases = drush_get_option('aliases'); $final_aliases = drush_get_option('aliases');
provision_reload_config('site', drush_get_option('new_site_path', d($new_name)->site_path) . '/drushrc.php'); provision_reload_config('site', drush_get_option('new_site_path', d($new_name)->site_path) . '/drushrc.php');
......
...@@ -131,6 +131,17 @@ function provision_is_local_host($host) { ...@@ -131,6 +131,17 @@ function provision_is_local_host($host) {
($host == provision_fqdn()); ($host == provision_fqdn());
} }
/**
* Determine if the currently acting context is the server's hostmaster site.
*
* @return
* Boolean TRUE if the current drush context is "@hostmaster".
*/
function provision_is_hostmaster_site() {
// If the current root and URI matches "@hostmaster" root and URI, this is hostmaster.
return d()->root == d('@hostmaster')->root && d()->uri == d('@hostmaster')->uri;
}
/** /**
* return the FQDN of the machine or provided host * return the FQDN of the machine or provided host
* *
......
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