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.

CommentFileSizeAuthor
#1 1573162.patch576 bytesmig5
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Status: Active » Needs review
FileSize
576 bytes

Patch attached if it makes sense to anyone else..

Steven Jones’s picture

Version: 6.x-1.8 » 6.x-1.9
Priority: Normal » Major
Status: Needs review » Needs work

I think it's just because the name of the hook should be: drush_hosting_task_rollback, and then it's picked up correctly.

Steven Jones’s picture

Status: Needs work » Fixed

Fixed this using approach in #2 in 6.x-2.x and 6.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

fix syntax

  • Commit 522c294 on 6.x-2.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by Steven Jones:
    Issue #1573162 by mig5, Steven Jones: Fixed Drush hosting_task_()%...

  • Commit 522c294 on 6.x-2.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by Steven Jones:
    Issue #1573162 by mig5, Steven Jones: Fixed Drush hosting_task_()%...