Commit 15c14e9c authored by Adrian Rossouw's avatar Adrian Rossouw

first part of fix for #874716. The files synch down but refuse to synch back up due to perm errors.

parent f82143da
...@@ -211,7 +211,7 @@ remote web Aegir users with no passwords. ...@@ -211,7 +211,7 @@ remote web Aegir users with no passwords.
They will also need a login shell, which can be modified using the `chsh` command. They will also need a login shell, which can be modified using the `chsh` command.
Shell command as root:: Shell command as root::
chsh -s /sbin/sh aegir chsh -s /bin/sh aegir
Database configuration Database configuration
---------------------- ----------------------
......
...@@ -67,6 +67,11 @@ class provisionService_http_cluster extends provisionService_http { ...@@ -67,6 +67,11 @@ class provisionService_http_cluster extends provisionService_http {
$this->_each_server(__FUNCTION__, $args); $this->_each_server(__FUNCTION__, $args);
} }
function fetch() {
$args = func_get_args();
$this->_each_server(__FUNCTION__, $args);
}
function grant_server_list() { function grant_server_list() {
return array_merge( return array_merge(
array_map('d', $this->server->cluster_web_servers), array_map('d', $this->server->cluster_web_servers),
......
...@@ -55,8 +55,14 @@ function drush_provision_drupal_provision_backup() { ...@@ -55,8 +55,14 @@ function drush_provision_drupal_provision_backup() {
$backup_file = drush_get_option('backup_file'); $backup_file = drush_get_option('backup_file');
// Adds the site directory into the backup file // Adds the site directory into the backup file
drush_log(dt("Adding sites directory to !backup_file", array('!backup_file' => $backup_file)), 'backup'); drush_log(dt("Adding sites directory to !backup_file", array('!backup_file' => $backup_file)), 'backup');
// synch all filesystem changes back from the remote server.
d()->service('http')->fetch(d()->site_path . '/files/');
$olddir = getcwd(); $olddir = getcwd();
// we need to do this because some retarded implementations of tar (e.g. SunOS) don't support -C // we need to do this because some retarded implementations of tar (e.g. SunOS) don't support -C
chdir(d()->site_path); chdir(d()->site_path);
if (substr($backup_file, -2) == 'gz') { if (substr($backup_file, -2) == 'gz') {
// same as above: some do not support -z // same as above: some do not support -z
......
...@@ -101,7 +101,7 @@ function drush_provision_drupal_provision_install_backend() { ...@@ -101,7 +101,7 @@ function drush_provision_drupal_provision_install_backend() {
function provision_drupal_sync_site() { function provision_drupal_sync_site() {
d()->service('http')->sync(d()->root, array('exclude-sites' => TRUE)); d()->service('http')->sync(d()->root, array('exclude-sites' => TRUE));
if (d()->type === 'site') { if (d()->type === 'site') {
d()->service('http')->sync(d()->site_path); d()->service('http')->sync(d()->site_path, array('no-delete' => TRUE));
} }
} }
......
...@@ -443,8 +443,15 @@ class provisionServer extends provisionEnvironment { ...@@ -443,8 +443,15 @@ class provisionServer extends provisionEnvironment {
$options = array_merge(array( $options = array_merge(array(
'relative' => TRUE, 'relative' => TRUE,
'omit-dir-times' => TRUE, 'omit-dir-times' => TRUE,
'delete' => TRUE,
), $additional_options); ), $additional_options);
// We need to do this due to how drush creates the rsync command.
// If the option is present at all , even if false or null, it will
// add it to the command.
if (!isset($additional_options['no-delete'])) {
$options['delete'] = TRUE;
}
if (drush_core_call_rsync(escapeshellarg($path), escapeshellarg($this->script_user . '@' . $this->remote_host . ':/'), $options, TRUE, FALSE)) { 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))); drush_log(dt('@path has been synced to remote server @remote_host.', array('@path' => $path, '@remote_host' => $this->remote_host)));
} }
...@@ -462,6 +469,36 @@ class provisionServer extends provisionEnvironment { ...@@ -462,6 +469,36 @@ class provisionServer extends provisionEnvironment {
} }
} }
} }
/**
* If necessary, fetch file from a remote server.
*
* @param $path
* Full path to fetch.
*/
function fetch($path) {
if (!provision_is_local_host($this->remote_host)) {
if (provision_file()->exists($path)->status()) {
$options = array(
'omit-dir-times' => TRUE,
);
if (drush_core_call_rsync(escapeshellarg($this->script_user . '@' . $this->remote_host . ':/') . $path, $path, $options, TRUE, FALSE)) {
drush_log(dt('@path has been fetched from remote server @remote_host.', array(
'@path' => $path,
'@remote_host' => $this->remote_host))
);
}
else {
drush_set_error('PROVISION_FILE_SYNC_FAILED', dt('@path could not be fetched from remote server @remote_host.' .
' Changes might not be available until this has been done. (error: %msg)', array(
'@path' => $path,
'@remote_host' => $this->remote_host,
'%msg' => join("\n", drush_shell_exec_output())))
);
}
}
}
}
} }
/** /**
......
...@@ -142,6 +142,10 @@ class provisionService extends provisionChainedState { ...@@ -142,6 +142,10 @@ class provisionService extends provisionChainedState {
return $this->server->sync($path, $additional_options); return $this->server->sync($path, $additional_options);
} }
function fetch($path = NULL) {
return $this->server->fetch($path);
}
function verify() { function verify() {
return TRUE; return 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