Certain commands (backup, for example) do not require that we rewrite the drushrc.php.

The way this is done right now is in the provision_drupal_drush_exit() hook, and that makes it impossible to cleanly (ie. through the hook_TASK_post()) to modify the drushrc ownership (for example). On top of that, it makes unnecessary writes.

We should explicitly write the drushrc in a post hook, and only when it's relevant.

Here are the tasks where it's irrelevant:

* backup
* login_reset
* delete backups
* clone (at least not in the original site context)
* delete
* disable

here are the tasks where it's relevant:

* verify
* install
* import?
* migrate
* restore

In the meantime, it's possible to add your own drush_exit() hook.

Comments

anarcat’s picture

... i meant to finish this by saying:

"your own drush_exit() hook".

Steven Jones’s picture

Version: 6.x-1.0-rc2 » 6.x-2.x-dev

So we should just have some flag to mark it as 'dirty' and if it needs writing at the end it is, otherwise it isn't.

ergonlogic’s picture

So we're talking about provision_drupal_drush_exit() here? It looks like it's already a preg_match() against the command name to determine whether to write drushrc.php. Could we just extend this regex to include the other irrelevant commands?

Alternatively, this is where we would check against a 'dirty' flag (e.g., drush_get_context('PROVISION_SAVE_DATA')), or something similar? Presumably this would be set in a hook_drush_exit() in each of the relevant tasks?

anarcat’s picture

A dirty flag sounds like a better idea.

ergonlogic’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Issue summary: View changes
Issue tags: -aegir-2.0

New features need to be implemented in Aegir 3.x, then we can consider back-porting to Aegir 2.x.

helmo’s picture

Issue summary: View changes

We already filter on "preg_match("/^provision-(save|delete)/", ..."

Can't we extend the drush command definition with a property to indicate if re-saving the drush rc is required?

helmo’s picture

Issue summary: View changes

Reading this again I see that we already have an opt-out way. In drush_provision_drupal_post_provision_import we do

drush_set_option('provision_save_config', false);

We could change the default for that and start to set it to true in the commands listed here in the summary.