I am finishing off adding git+makefile driven deployments in devshop and need to trigger a "migrate" task in the front-end, and wait for it to finish.

The problem is that migrate task requires certain task_args to be present, but currently you cannot create task_args using the drush command "hosting-task"

To do this, I tried

drush @hostmaster hosting-task mysite.com migrate --platform=newplatform

but this didn't work because task_args are not passed at all in the hosting-task command.

We shouldn't pass all drush options as task_args, so I figured out that we can use drush arguments as 'name=value' pairs.

I was able to patch hosting-task command to parse extra drush arguments into task_args like so (The migrate task requires three task_args)

drush @hostmaster hosting-task mysite.com migrate target_platform=123 new_uri=mysite.com new_db_server=100

I'm including this patch in devshop because we need it to properly trigger a Migrate task after a git pull and a drush make.

Comments

Jon Pugh created an issue. See original summary.

  • Jon Pugh committed b39cefc on 2845040-drush-hosting-task-args
    Issue #2845040: Allow task_args to be passed from `drush hosting-task`...
  • Jon Pugh committed ea5b169 on 2845040-drush-hosting-task-args
    Issue #2845040: Allow task_args to be passed from `drush hosting-task`...
helmo’s picture

neat

helmo’s picture

Status: Needs review » Reviewed & tested by the community

rtbc with one whitespace fix.

  • Jon Pugh committed b39cefc on 7.x-3.x
    Issue #2845040: Allow task_args to be passed from `drush hosting-task`...
  • Jon Pugh committed ea5b169 on 7.x-3.x
    Issue #2845040: Allow task_args to be passed from `drush hosting-task`...
helmo’s picture

Status: Reviewed & tested by the community » Fixed

merged

Status: Fixed » Closed (fixed)

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

helmo’s picture

Closed an old duplicate of this in #1003536: allow arguments to hosting-task @site task

helmo’s picture

Not sure where to document this, but for tasks that require an argument (not option) you need to know some 'magic'.

drush @hostmaster hosting-task @platform_someplatform git-checkout checkout_git_ref=some-feature-branch

When starting such a task via the UI code in drush_hosting_git_pre_hosting_task() handles this.
Or maybe we should stop using arguments in 4.x, and convert to options.