Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I can't seem to make any trigger work with conditions.
See http://pastebin.com/A0VXQ4DJ for some tested rules.
My ultimate goal is to send an email when a backup fails, but I would settle for sending an email when any task fails.
Comments
Comment #1
gboudrias CreditAttribution: gboudrias commentedAfter some tests, I think the conditions are not evaluated at the right moment, as the task_status seems to always be -1 (which I believe is processing).
Comment #2
gboudrias CreditAttribution: gboudrias commentedI'm pretty sure the problem is that we're implementing function drush_aegir_rules_pre_hosting_task(), which (as far as I can remember), triggers right after the task has been set to "processing.
What we want in most instances would be drush_aegir_rules_post_hosting_task(), but I can't seem to make that work. I'm not sure if it's not implemented or if I'm missing something. At worst we could resort to individual triggers: http://api.aegirproject.org/api/aegir/hosting2!hosting.api.php/function/...
Comment #3
gboudrias CreditAttribution: gboudrias commentedOk I had a non-functional site, drush_aegir_rules_post_hosting_task() does work as expected.
However the status of the task isn't set until after that hook is processed, in hosting_task_drush_init().
Comment #4
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedThis relates a bit to #2772635: Hook into task failure
We might also have to switch from the pre_ hook to something that is run just before all the others pre hooks. I think the drush_hosting_task_validate() might be the place to start invoking a new hook for this.
Comment #5
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedComment #6
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedFor the initial goal from #0 "send an email when a backup fails" you need a post event, which now works as per the example in the README file.
Looking at the task log below the processing state is started from the validate hook. So I'm not dure we have any earlier hooks.
I'm closing for now as the start may say processing but the event is fired before the work is actually started... please re-open if you find a usecase or hook that affects this.