Commit 35cbed38 authored by drumm's avatar drumm Committed by Neil Drumm

Cluster platforms should be working.

parent 081abe81
......@@ -5,11 +5,6 @@ require_once DRUSH_BASE_PATH . '/commands/core/rsync.core.inc';
class provisionService_file_remote extends provisionService_file {
protected $operations = array();
function init() {
$this->config_path = $this->config_path . '--' . $this->remote_host;
parent::init();
}
function chmod($path, $perms) {
parent::chmod($path, $perms);
$this->operations[] = array(__FUNCTION__, func_get_args());
......@@ -36,12 +31,13 @@ class provisionService_file_remote extends provisionService_file {
if ($this->exists($path)->status()) {
$options = array(
'relative' => TRUE,
'omit-dir-times' => TRUE,
'delete' => TRUE,
);
if ($exclude_sites) {
$options['exclude-sites'] = TRUE;
}
if (drush_core_call_rsync(escapeshellarg($path), escapeshellarg($this->script_user . '@' . $this->remote_host . ':/'), $options)) {
if (drush_core_call_rsync(escapeshellarg($path), escapeshellarg($this->script_user . '@' . $this->remote_host . ':/'), $options, TRUE, FALSE)) {
drush_log(dt('@path has been synced to remote server @remote_host.', array('@path' => $path, '@remote_host' => $this->remote_host)));
}
else {
......
......@@ -10,9 +10,9 @@ class provisionService_http_apache extends provisionService_http {
function init() {
parent::init();
$this->apache_site_conf_path = $this->config_path . '/vhost.d';
$this->apache_platform_conf_path = $this->config_path . '/platform.d';
$this->apache_conf_path = $this->config_path . '/apache.d';
$this->apache_site_conf_path = d()->config_path . '/vhost.d';
$this->apache_platform_conf_path = d()->web_server->config_path . '/platform.d';
$this->apache_conf_path = d()->config_path . '/apache.d';
// Commands
$this->setProperty('restart_cmd', _provision_default_restart_cmd());
......@@ -46,10 +46,10 @@ class provisionService_http_apache extends provisionService_http {
}
function create_server_config() {
$this->server()->service('file')->create_dir($this->apache_site_conf_path, dt("Virtual host configuration"), 0700);
$this->server()->service('file')->create_dir($this->apache_platform_conf_path, dt("Platforms configuration"), 0700);
$this->server()->service('file')->create_dir($this->apache_conf_path , dt("Apache configuration"), 0700);
$this->server()->service('file')->sync($this->apache_conf_path);
d()->service('file')->create_dir($this->apache_site_conf_path, dt("Virtual host configuration"), 0700);
d()->service('file')->create_dir($this->apache_platform_conf_path, dt("Platforms configuration"), 0700);
d()->service('file')->create_dir($this->apache_conf_path , dt("Apache configuration"), 0700);
d()->service('file')->sync($this->apache_conf_path);
$config = new provisionConfig_apache_server($this->context);
return $config->write();
......@@ -85,7 +85,7 @@ class provisionConfig_apache_server extends provisionConfig_apache {
public $description = 'apache server configuration file';
function filename() {
return $this->config_path . '/apache.conf';
return d()->config_path . '/apache.conf';
}
function process() {
......@@ -119,7 +119,7 @@ class provisionConfig_apache_site extends provisionConfig_apache {
public $description = 'apache site configuration file';
function filename() {
return $this->platform->server->apache_site_conf_path . '/' . $this->uri . '_' . $this->site_port;
return $this->apache_site_conf_path . '/' . $this->uri . '_' . $this->site_port;
}
function process() {
......
# Aegir web server configuration file
<?php if (is_array($this->web_ports)) :
foreach ($this->web_ports as $web_port) :?>
<?php if (is_array(d()->web_ports)) :
foreach (d()->web_ports as $web_port) :?>
NameVirtualHost *:<?php print $web_port; ?>
<VirtualHost *:<?php print $web_port; ?>>
......
......@@ -17,31 +17,35 @@ class provisionService_http_cluster extends provisionService_http {
}
}
function _one_server($method) {
d($this->cluster_web_servers[0])->service('http')->$method();
}
function parse_configs() {
$this->_each_server(__FUNCTION__);
}
function create_site_config() {
$this->_each_server(__FUNCTION__);
$this->_one_server(__FUNCTION__);
}
function delete_site_config() {
$this->_each_server(__FUNCTION__);
$this->_one_server(__FUNCTION__);
}
function create_platform_config() {
$this->_each_server(__FUNCTION__);
$this->_one_server(__FUNCTION__);
}
function delete_platform_config() {
$this->_each_server(__FUNCTION__);
$this->_one_server(__FUNCTION__);
}
function create_server_config() {
$this->_each_server(__FUNCTION__);
$this->_one_server(__FUNCTION__);
}
function delete_server_config() {
$this->_each_server(__FUNCTION__);
$this->_one_server(__FUNCTION__);
}
}
......@@ -31,6 +31,8 @@ function drush_provision_drupal_provision_verify() {
$config = new provisionConfig_global_settings(d()->name);
$config->write();
}
d()->service('file')->sync(d()->config_path . '/includes');
if (d()->name == '@server_localhost') {
d()->service('file')->create_dir(d()->backup_path, dt('Backup'), 0700);
}
......
......@@ -85,8 +85,8 @@ class provisionConfig {
function write() {
$filename = $this->filename();
// Make directory structure if it does not exist.
if (!$this->owner()->service('file')->exists(dirname($filename))->status()) {
$this->owner()->service('file')->mkdir(dirname($filename))
if (!d()->service('file')->exists(dirname($filename))->status()) {
d()->service('file')->mkdir(dirname($filename))
->succeed('Created directory @path.')
->fail('Could not create directory @path.');
}
......@@ -97,34 +97,34 @@ class provisionConfig {
if ($template = $this->load_template()) {
// Make sure we can write to the file
if (!is_null($this->mode) && !($this->mode & 0200) && $this->owner()->service('file')->exists($filename)->status()) {
$this->owner()->service('file')->chmod($filename, $this->mode | 0200)
if (!is_null($this->mode) && !($this->mode & 0200) && d()->service('file')->exists($filename)->status()) {
d()->service('file')->chmod($filename, $this->mode | 0200)
->succeed('Changed permissions of @path to @perm')
->fail('Could not change permissions of @path to @perm');
}
$this->owner()->service('file')->file_put_contents($filename, $this->render_template($template, $this->data), $this->append ? FILE_APPEND : 0)
d()->service('file')->file_put_contents($filename, $this->render_template($template, $this->data), $this->append ? FILE_APPEND : 0)
->succeed('Generated config ' . (empty($this->description) ? $filename : $this->description), 'success');
// Change the permissions of the file if needed
if (!is_null($this->mode)) {
$this->owner()->service('file')->chmod($filename, $this->mode)
d()->service('file')->chmod($filename, $this->mode)
->succeed('Changed permissions of @path to @perm')
->fail('Could not change permissions of @path to @perm');
}
if (!is_null($this->group)) {
$this->owner()->service('file')->chgrp($filename, $this->group)
d()->service('file')->chgrp($filename, $this->group)
->succeed('Change group ownership of @path to @gid')
->fail('Could not change group ownership of @path to @gid');
}
$this->owner()->service('file')->sync($this->filename());
d()->service('file')->sync($this->filename());
}
}
}
function unlink() {
$this->owner()->service('file')->unlink($this->filename())->status();
$this->owner()->service('file')->sync($this->filename());
d()->service('file')->unlink($this->filename())->status();
d()->service('file')->sync($this->filename());
}
}
......
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