Commit 568047de authored by omega8cc's avatar omega8cc

Merge branch '6.x-2.x' of git.drupal.org:project/provision into dev-nginx-6.x-2.x

parents 6623aeba be655988
......@@ -51,7 +51,10 @@ class Provision_Context {
}
if (array_key_exists($name, $this->properties)) {
if (isset($this->oid_map[$name]) && !empty($this->properties[$name])) {
return d($this->properties[$name]);
$service = d($this->properties[$name], FALSE, FALSE);
if (!is_null($service)) {
return $service;
}
}
else {
return $this->properties[$name];
......
......@@ -52,7 +52,10 @@ class Provision_Context_server extends Provision_Context {
}
else {
$this->aegir_root = d('@server_master')->aegir_root;
$this->script_user = d('@server_master')->script_user;
// In certain cicumstances it might be useful to have different
// script_users on different Aegir servers, but this could also cause
// weird things to happen, so use with caution!
$this->setProperty('script_user', d('@server_master')->script_user);
}
$this->setProperty('ip_addresses', array(), true);
......
......@@ -13,6 +13,30 @@ aegir-provision (2.0~alpha) UNRELEASED; urgency=low
-- Antoine Beaupré <anarcat@debian.org> Tue, 06 Mar 2012 14:39:41 -0500
aegir-provision (1.8) testing; urgency=low
* new release: various bugfixes to regressions introduced in 1.7, a few
general bug fixes and lots of Nginx fixes.
-- Steven Jones <steven.jones@computerminds.co.uk> Wed, 18 Apr 2012 09:34:44 +0100
aegir-provision (1.7) testing; urgency=low
* new release: various bugfixes that have accumulated in the issue queue
since the 1.6 release, including a lot of fixes on Nginx support. We
also ship a new clustering module aimed at lightweight slave
deployments named the pack module, designed to replace the cluster
module which has performance and configuration issues.
-- Antoine Beaupré <anarcat@debian.org> Tue, 06 Mar 2012 18:39:37 -0500
aegir-provision (1.6+dev) unstable; urgency=low
* merge in the debian branch to the main 1.x branch, making this a
native package.
-- Antoine Beaupré <anarcat@debian.org> Thu, 16 Feb 2012 15:47:18 -0500
aegir-provision (1.6-1+webpack) testing; urgency=low
* special build for the dev-webpack1x branch
......
......@@ -63,7 +63,7 @@ Description: mass Drupal hosting system
Package: aegir-cluster-slave
Architecture: all
Depends: ${misc:Depends}, php5-mysql, sudo, apache2, adduser, ucf, libapache2-mod-php5, rsync, nfs-client
Depends: ${misc:Depends}, php5-mysql, sudo, apache2, adduser, ucf, libapache2-mod-php5, rsync, nfs-client, mysql-client
Recommends: php5-gd, php5
Description: web frontend for the Aegir hosting system
Configuration of lightweight slave servers for the Aegir "pack"
......
......@@ -146,10 +146,10 @@ function drush_provision_hostmaster_install($site = NULL) {
'db_service_type' => 'mysql',
'master_db' => $master_db,
);
drush_backend_invoke_args("provision-save", array($dbserver), $dbserver_context);
drush_invoke_process('@none', "provision-save", array($dbserver), $dbserver_context);
provision_backend_invoke($dbserver, 'provision-verify');
}
drush_backend_invoke_args("provision-save", array($server), $master_context);
drush_invoke_process('@none', "provision-save", array($server), $master_context);
provision_backend_invoke($server, 'provision-verify');
// exit if an error has occured.
......@@ -161,12 +161,8 @@ function drush_provision_hostmaster_install($site = NULL) {
return;
}
if (!function_exists('drush_make_drush_command')) {
drush_backend_invoke('dl', array('drush_make-' . drush_get_option('drush_make_version'), 'destination' => $aegir_root . '/.drush/'));
}
$platform_name = '@platform_hostmaster';
drush_backend_invoke_args("provision-save", array($platform_name), array(
drush_invoke_process('@none', "provision-save", array($platform_name), array(
'context_type' => 'platform',
'server' => $server,
'web_server' => $server,
......@@ -186,7 +182,7 @@ function drush_provision_hostmaster_install($site = NULL) {
}
$site_name = '@hostmaster';
drush_backend_invoke_args("provision-save", array($site_name), array(
drush_invoke_process('@none', "provision-save", array($site_name), array(
'context_type' => 'site',
'platform' => $platform_name,
'db_server' => $dbserver,
......@@ -204,6 +200,7 @@ function drush_provision_hostmaster_install($site = NULL) {
drush_print(dt("Initializing the hosting system"));
drush_invoke_process('@none', 'cache-clear', array('drush'));
provision_backend_invoke($site_name, 'hosting-setup');
drush_print("");
......@@ -221,3 +218,12 @@ function drush_provision_hostmaster_install($site = NULL) {
drush_print("");
}
/**
* Implements drush_hook_post_hostmaster_install().
*/
function drush_provision_post_hostmaster_install() {
$backend_only = drush_get_option('backend-only');
if (empty($backend_only)) {
drush_invoke_process('@hostmaster', 'cache-clear', array('drush'));
}
}
......@@ -44,7 +44,7 @@ We are making the following assumptions:
drush_set_option('old_platform', d('@hostmaster')->platform->name);
$new_platform = '@platform_' . preg_replace("/[!\W]/", "", basename(rtrim($platform, '/')));
drush_backend_invoke_args("provision-save", array($new_platform), array(
drush_invoke_process('@none', "provision-save", array($new_platform), array(
'context_type' => 'platform',
'server' => '@server_master',
'web_server' => '@server_master',
......@@ -67,7 +67,7 @@ We are making the following assumptions:
* 'options' when we drop drush3 support
*/
$context = drush_get_context('cli') ? 'cli' : 'options';
drush_backend_invoke_args("provision-save", array($server), array(
drush_invoke_process('@none', "provision-save", array($server), array(
'context_type' => 'server',
'aegir_root' => dirname(rtrim($data['config_path'], '/')),
'remote_host' => php_uname('n'),
......@@ -91,7 +91,7 @@ We are making the following assumptions:
$old_platform = '@platform_' . preg_replace("/[!\W]/", "", basename(rtrim($data['publish_path'], '/')));
drush_backend_invoke_args("provision-save", array($old_platform), array(
drush_invoke_process('@none', "provision-save", array($old_platform), array(
'context_type' => 'platform',
'server' => $server,
'web_server' => $server,
......@@ -105,7 +105,7 @@ We are making the following assumptions:
}
$new_platform = '@platform_' . preg_replace("/[!\W]/", "", basename(rtrim($platform, '/')));
drush_backend_invoke_args("provision-save", array($new_platform), array(
drush_invoke_process('@none', "provision-save", array($new_platform), array(
'context_type' => 'platform',
'server' => $server,
'web_server' => $server,
......@@ -121,7 +121,7 @@ We are making the following assumptions:
$site_name = '@hostmaster';
drush_backend_invoke_args("provision-save", array($site_name), array(
drush_invoke_process('@none', "provision-save", array($site_name), array(
'context_type' => 'site',
'platform' => $old_platform,
'db_server' => $server,
......
......@@ -62,7 +62,7 @@ function drush_provision_drupal_provision_clone($new_uri, $platform = null) {
$options['db_server'] = $db_server;
}
drush_backend_invoke_args('provision-save', array($new_uri), $options);
drush_invoke_process('@none', 'provision-save', array($new_uri), $options);
# note that we reset the aliases so they don't conflict with the original site
provision_backend_invoke($new_uri, 'provision-deploy', array(drush_get_option('backup_file')), array('old_uri' => d()->uri));
......
......@@ -17,6 +17,8 @@
/**
* Make sure we have a valid site being deployd, and that the file being deployd from exists
*
* Implementation of drush_hook_COMMAND_validate().
*/
function drush_provision_drupal_provision_deploy_validate($backup_file = null) {
$exists = provision_file()->exists($backup_file)
......@@ -44,6 +46,8 @@ function drush_provision_drupal_provision_deploy_validate($backup_file = null) {
/**
* Make a backup before making any changes, and add extract the file we are restoring from
*
* Implementation of drush_hook_pre_COMMAND().
*/
function drush_provision_drupal_pre_provision_deploy($backup_file) {
// the url is likely to have changed in the deployment
......@@ -83,7 +87,7 @@ function drush_provision_drupal_pre_provision_deploy($backup_file) {
$site_packages = drush_get_option('packages', array(), 'site');
$drupal_packages = drush_get_option('packages', array(), 'drupal');
$merged_modules = $drupal_packages['base']['modules'];
$merged_modules = isset($drupal_packages['base']['modules']) ? $drupal_packages['base']['modules'] : array();
if (isset($site_packages['profiles'])) {
$profiles = array_keys($site_packages['profiles']);
$profile = $profiles[0];
......@@ -117,6 +121,8 @@ function drush_provision_drupal_pre_provision_deploy($backup_file) {
/**
* Remove the extracted site directory
*
* Implementation of drush_hook_pre_COMMAND_rollback().
*/
function drush_provision_drupal_pre_provision_deploy_rollback() {
if (drush_get_option('deploy_replace_site', FALSE)) {
......@@ -140,11 +146,17 @@ function drush_provision_drupal_pre_provision_deploy_rollback() {
}
}
/**
* Implementation of drush_hook_COMMAND().
*/
function drush_provision_drupal_provision_deploy() {
_provision_drupal_maintain_aliases();
_provision_drupal_create_directories();
}
/**
* Implementation of drush_hook_post_COMMAND().
*/
function drush_provision_drupal_post_provision_deploy() {
// call the drush updatedb command.
provision_backend_invoke(d()->name, 'updatedb');
......
......@@ -80,10 +80,16 @@ function install_main() {
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION);
// We have an existing settings.php.
if (function_exists('drush_sql_read_db_spec')) {
// Drush 5.
if (function_exists('_drush_sql_get_db_spec')) {
$db_spec = _drush_sql_get_db_spec();
}
// Drush 4.
elseif (function_exists('drush_sql_read_db_spec')) {
$db_spec = drush_sql_read_db_spec();
}
// Drush 3.
else {
$db_spec = drush_core_site_install_db_spec();
}
......
......@@ -6,6 +6,8 @@
/**
* Make sure we have a valid site being migrated, and that the file being migrated from exists
*
* Implementation of drush_hook_COMMAND_validate().
*/
function drush_provision_drupal_provision_migrate_validate($platform = NULL) {
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_SITE);
......@@ -13,6 +15,8 @@ function drush_provision_drupal_provision_migrate_validate($platform = NULL) {
/**
* Make a backup before making any changes, and add extract the file we are restoring from
*
* Implementation of drush_hook_pre_COMMAND().
*/
function drush_provision_drupal_pre_provision_migrate($platform, $new_uri = NULL) {
/* Set offline mode to true and re-generate the settings.php. This will write a
......@@ -45,6 +49,8 @@ function drush_provision_drupal_pre_provision_migrate($platform, $new_uri = NULL
/**
* Remove the extracted site directory
* Restore the vhost conf per the original platform
*
* Implementation of drush_hook_pre_COMMAND_rollback().
*/
function drush_provision_drupal_pre_provision_migrate_rollback($platform, $new_uri = NULL) {
// Set site_offline to false and regenerate the config
......@@ -61,6 +67,8 @@ function drush_provision_drupal_pre_provision_migrate_rollback($platform, $new_u
/**
* Switch the migrate directories around now that we have the new db installed
*
* Implementation of drush_hook_COMMAND().
*/
function drush_provision_drupal_provision_migrate($platform, $new_uri = NULL) {
......@@ -89,7 +97,7 @@ function drush_provision_drupal_provision_migrate($platform, $new_uri = NULL) {
drush_set_option('new_site_path', "{$options['root']}/sites/{$options['uri']}");
drush_backend_invoke_args('provision-save', array($target), $options);
drush_invoke_process('@none', 'provision-save', array($target), $options);
provision_backend_invoke($target, 'provision-deploy', array(drush_get_option('backup_file')), array('old_uri' => d()->uri));
if (!drush_get_error()) {
drush_log(dt("Bringing site out of maintenance"));
......@@ -101,13 +109,17 @@ function drush_provision_drupal_provision_migrate($platform, $new_uri = NULL) {
/**
* Something went wrong
*
* Implementation of drush_hook_COMMAND_rollback().
*/
function drush_provision_drupal_provision_migrate_rollback($platform) {
drush_backend_invoke_args('provision-save', array(d()->name), array('platform' => drush_get_option('old_platform'), 'root' => NULL, 'uri' => NULL));
drush_invoke_process('@none', 'provision-save', array(d()->name), array('platform' => drush_get_option('old_platform'), 'root' => NULL, 'uri' => NULL));
}
/**
* Delete the old site directory and recreate the settings file
*
* Implementation of drush_hook_post_COMMAND().
*/
function drush_provision_drupal_post_provision_migrate($platform, $new_uri = NULL) {
drush_set_option('installed', FALSE);
......
......@@ -370,7 +370,6 @@ function _provision_drupal_maintain_aliases() {
}
else {
_provision_drupal_delete_aliases();
if (!d()->redirection) {
foreach (d()->aliases as $alias) {
if ($alias = trim($alias)) {
......@@ -399,7 +398,6 @@ function _provision_drupal_delete_aliases() {
}
else {
$aliases = provision_drupal_find_aliases();
foreach ($aliases as $alias) {
$path = d()->root . '/sites/' . $alias;
provision_file()->unlink($path)
......
......@@ -55,7 +55,7 @@ function drush_provision_drupal_pre_provision_verify() {
}
$options[] = d()->makefile;
$options[] = d()->root;
drush_backend_invoke("make", $options);
drush_invoke_process('@none', "make", $options);
if (drush_get_error()) {
return drush_set_error("DRUSH_MAKE_FAILED",
"Could not download platform using drush make. No platform present");
......
......@@ -133,13 +133,15 @@ function drush_provision_tests_install_platform($platform_name, $platform_alias
PROVISION_TESTS_BUILDS_REPO . "/$platform_name.build",
"/var/aegir/platforms/$platform_alias"
);
drush_backend_invoke('make', $args);
drush_invoke_process('@none', 'make', $args);
$args = array(
'root' => "/var/aegir/platforms/$platform_alias",
"@platform_$platform_alias",
);
$options = array(
'root' => "/var/aegir/platforms/$platform_alias",
'context_type' => 'platform',
);
drush_backend_invoke('provision-save', $args);
provision_backend_invoke('@none', 'provision-save', $args, $options);
provision_backend_invoke('@hostmaster', 'hosting-import', array("@platform_$platform_alias",));
drush_provision_tests_run_remaining_tasks();
}
......@@ -167,7 +169,7 @@ function drush_provision_tests_install_site($platform_name, $site, $profile_name
'db_server' => '@server_localhost',
'root' => "/var/aegir/platforms/$platform_name",
);
drush_backend_invoke('provision-save', $args);
drush_invoke_process('@none', 'provision-save', $args);
provision_backend_invoke("@$site.aegir.example.com", 'provision-install');
provision_backend_invoke('@hostmaster', 'hosting-task', array("@platform_$platform_name", 'verify'), array('force' => TRUE));
drush_provision_tests_run_remaining_tasks();
......
......@@ -12,11 +12,15 @@
* A Drush alias name, including leading @.
* @param $_root_object
* Internal use only, set default object returned by d().
* @param $allow_creation
* Defaults to TRUE. Allows creating a new context object with the specified
* $name.
*
* @return
* Provision_Context object.
* provision_Context object or NULL if it can't be loaded and
* $allow_creation == FALSE.
*/
function & d($name = NULL, $_root_object = FALSE) {
function & d($name = NULL, $_root_object = FALSE, $allow_creation = TRUE) {
static $instances = null;
static $default_instance = '@self';
......@@ -40,10 +44,11 @@ function & d($name = NULL, $_root_object = FALSE) {
return $instances[$name];
}
else {
$instances[$name] = provision_context_factory($name);
$instances[$name]->method_invoke('init');
$instances[$name]->type_invoke('init');
$instances[$name] = provision_context_factory($name, $allow_creation);
if (!is_null($instances[$name])) {
$instances[$name]->method_invoke('init');
$instances[$name]->type_invoke('init');
}
return $instances[$name];
}
}
......@@ -68,14 +73,26 @@ function provision_sitealias_get_record($name) {
}
/**
* Create a new context object and cache it in the d() static cache
* function.
* Create a new context object.
*
* @param $name
* The name of the context object to instantiate.
* @param $allow_creation
* Defaults to TRUE. Allows creating a new context object with the specified
* $name.
*
* @return
* An instance of the specified context, or NULL if it could not be loaded.
*/
function provision_context_factory($name) {
function provision_context_factory($name, $allow_creation = TRUE) {
// the default type, can also be 'platform' or 'site'
$type = 'server';
$record = provision_sitealias_get_record($name);
if (!$allow_creation && empty($record)) {
drush_set_error('PROVISION_MISSING_CONTEXT', dt('Could not find provision alias named: @name' , array('@name' => $name)));
return NULL;
}
$options = array_merge(drush_get_context('stdin'), drush_get_context('options'), drush_get_context('cli'));
if (isset($record['context_type'])) {
......
This diff is collapsed.
......@@ -23,6 +23,7 @@ prompt_yes_no() {
}
version=$1
major="6.x"
if [ $# -lt 1 -o "$version" = "-h" ]; then
cat <<EOF
......@@ -42,7 +43,7 @@ official release. If you are not one of those people, you probably
shouldn't be running this.
This script is going to modify the configs and documentation to
release $version.
release $major-$version.
EOF
cat <<EOF
......@@ -74,18 +75,18 @@ git add debian/changelog
echo changing makefile to download tarball
#sed -i'.tmp' -e'/^projects\[hostmaster\]\[download\]\[type\]/s/=.*$/ = "get"/' \
# -e'/^projects\[hostmaster\]\[download\]\[url\]/s#=.*$#= "http://ftp.drupal.org/files/projects/hostmaster-'$version'.tgz"#' \
# -e'/^projects\[hostmaster\]\[download\]\[url\]/s#=.*$#= "http://ftp.drupal.org/files/projects/hostmaster-'$major-$version'.tgz"#' \
# -e'/^projects\[hostmaster\]\[download\]\[branch\].*/s/\[branch\] *=.*$/[directory_name] = "hostmaster"/' aegir.make && git add aegir.make && rm aegir.make.tmp
sed -i'.tmp' -e'/^projects\[hostmaster\]\[download\]\[type\]/s/=.*$/= "git"/' \
-e'/^projects\[hostmaster\]\[download\]\[url\]/s#=.*$#= "http://git.drupal.org/project/hostmaster.git"#' \
-e'/^projects\[hostmaster\]\[download\]\[branch\].*/s/\[branch\] *=.*$/[tag] = "'$version'"/' aegir.make && git add aegir.make && rm aegir.make.tmp
-e'/^projects\[hostmaster\]\[download\]\[branch\].*/s/\[branch\] *=.*$/[tag] = "'$major-$version'"/' aegir.make && git add aegir.make && rm aegir.make.tmp
echo changing provision.info version
sed -i'.tmp' -e"s/version *=.*$/version=$version/" provision.info
sed -i'.tmp' -e"s/version *=.*$/version=$major-$version/" provision.info
git add provision.info && rm provision.info.tmp
echo changing upgrade.sh.txt version
sed -i'.tmp' -e"s/AEGIR_VERSION=.*$/AEGIR_VERSION=\"$version\"/" upgrade.sh.txt && git add upgrade.sh.txt && rm upgrade.sh.txt.tmp
sed -i'.tmp' -e"s/AEGIR_VERSION=.*$/AEGIR_VERSION=\"$major-$version\"/" upgrade.sh.txt && git add upgrade.sh.txt && rm upgrade.sh.txt.tmp
echo resulting changes to be committed:
git diff --cached | cat
......@@ -101,10 +102,15 @@ fi
commitmsg=`git commit -m"change version information for release $version"`
echo $commitmsg
commitid=`echo $commitmsg | sed 's/^\[[^ ]* \([a-z0-9]*\)\].*$/\1/'`
sed -n '1,/ --/p' debian/changelog | git tag -a -F - $version
sed -n '1,/ --/p' debian/changelog | git tag -a -F - $major-$version
echo reverting tree to HEAD versions
git revert $commitid
git revert --no-commit $commitid
# Unstage the debian/changelog change, as we don't want to revert that.
git reset --quiet HEAD 'debian/changelog'
git checkout -- 'debian/changelog'
git commit
if prompt_yes_no "push tags and commits upstream? (y/N) "; then
# this makes sure we push the commit *and* the tag
......
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