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.
Thanks to adrian in #783642: Code to use drush to enqueue Aegir tasks for enabled sites, just as if it had been done via the ui, we can now enqueue (or requeue) real tasks from the backend:
drush @hostmaster hosting-task @example.com verify
But tasks like migrate or clone require arguments to function properly, which hosting-task doesn't support. This needs to be done for this feature to be really really cool and complete.
Comment | File | Size | Author |
---|---|---|---|
#6 | hostmaster-1003536-task-args.patch | 1.24 KB | Steven Jones |
Comments
Comment #1
Steven Jones CreditAttribution: Steven Jones commentedYup, it does. I came across this limitation, and it's a bit of a pain to workaround.
Subscribe.
Comment #2
Robin Millette CreditAttribution: Robin Millette commentedsubbing
Comment #3
tema CreditAttribution: tema commentedme too )
Comment #4
Steven Jones CreditAttribution: Steven Jones commentedWould love to have this.
Comment #5
Steven Jones CreditAttribution: Steven Jones commentedI need this, I don't think we can just grab the arguments directly from the command line, because they would also be used as arguments for the hosting-task command itself, which might have unexpected consequences. My current thinking is that we should just allow an additional option:
--task-arguments
that accepts a JSON encoded array of arguments to pass directly into the task. This way we don't get any clashing. There is some precedent for using JSON to pass stuff around in Drush, that's how the backend invoke stuff works and can return data.Comment #6
Steven Jones CreditAttribution: Steven Jones commentedSo you can allow passing of the task args quite easily acutally, see the attached patch. But it's not actually much use, because the possible arguments are not defined anywhere, so you can't get default values etc. We should tighten the API in 2.x, also you can't really use it anyway, because most of the arguments are using internal hostmaster node IDs, instead of the context machine names, so we are expecting people using the command line to know the node IDs for the platforms they want etc. which is just silly.
This patch does work nicely for creating backup tasks with specific descriptions etc.
Comment #7
gmania CreditAttribution: gmania commentedWe needed to be able to migrate from the command line as part of our "lite" continuous integration approach
http://community.aegirproject.org/discuss/our-zero-touch-build-setup-con...
This should be part of aegir core, but for now, Drush script to the rescue!
The following drush script takes as arguments the name of the site to migrate, and the name of the target platform, and looks up all the information needed to add a hosting migrate task to the front-end, and migrate the site on the backend. Since aegir tasks happen asynchronously, we also added a waiting period of up to 10 minutes for the platform to be available, since in the case of our automated deployment, we need to give it time to build
Here’s the drush script. Just add it anywhere in your /var/aegir directory (remember to chmod u+x it so that it can be run from the shell)
migrate.drush
To run it, call it within the hostmaster context:
/var/aegir/makes/migrate.drush @hostmaster SITE_TO_MIGRATE TARGET_PLATFORM
Comment #8
ergonlogicNew features need to be implemented in Aegir 3.x, then we can consider back-porting to Aegir 2.x.
Comment #9
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedThis is now fixed in #2845040: Allow task_args to be passed from `drush hosting-task` command.