I discovered a rollback hook in modules/hosting/site/hosting_site.drush.inc, that is meant to execute when the 'Verify' task fails.
function hosting_site_hosting_verify_task_rollback($task, $data) {
if ($task->ref->type == 'site') {
$task->ref->no_verify = TRUE;
$task->ref->verified = 0;
node_save($task->ref);
}
}
However, this is actually never executed, because it seems this function in task.hosting.inc is never honoured:
function drush_hosting_hosting_task_rollback() {
$task =& drush_get_context('HOSTING_TASK');
module_invoke_all(sprintf("hosting_%s_task_rollback", $task->task_type), $task, drush_get_context('HOSTING_DRUSH_OUTPUT'));
}
When I run this:
drush @hostmaster hosting-task --show-invoke
Drush tells me:
Available rollback hooks for hosting-task: [ok]
drush_hosting_task_validate_rollback
I have found that changing the function name drush_hosting_hosting_task_rollback() to drush_hosting_task_validate_rollback(), means that the rollback hook in the site feature is honoured. It also means that I can create a rollback hook for when verifying a platform fails (which was how I discovered all this).
Not sure if that's the correct fix though. I don't quite understand why Drush has decided only a _validate hook for hosting_task can have a rollback hook.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1573162.patch | 576 bytes | mig5 |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedPatch attached if it makes sense to anyone else..
Comment #2
Steven Jones CreditAttribution: Steven Jones commentedI think it's just because the name of the hook should be:
drush_hosting_task_rollback
, and then it's picked up correctly.Comment #3
Steven Jones CreditAttribution: Steven Jones commentedFixed this using approach in #2 in 6.x-2.x and 6.x-1.x.
Comment #4.0
(not verified) CreditAttribution: commentedfix syntax