Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get _exec return Message & Data for task capturing?? (Feature Request) #1126

Open
danshumaker opened this issue Sep 29, 2022 · 0 comments

Comments

@danshumaker
Copy link

danshumaker commented Sep 29, 2022

I wrote a "acquia_deploy.php" that uses blt and robo to launch deploys. It works great except I can't seem to do simple things like get the task UUID back from an acquia launched task. Since I am a command line junky I like to do all things Acquia admin via the command line even though the Acquia web interface does all this for you.

For example I have this batch script that copies the prod db down to the dev db as well as the files. After it launches those tasks it extracts the returned task UUID and launches another (sleep & and check status) bash script that will tell me when the task is done. This is very handy and I use it all the time


#!/bin/bash -xv
# Copy the database and files from production to dev.
# Arg 1 should be either "dev" or "test" to specify a destination.

db_copy_task=$(acli api:environments:database-copy @xxxx.$1 xxxxx @xxxx.prod | jq '._links.notification.href')
file_copy_task=$(acli api:environments:file-copy @xxxxx.$1 --source=xxxxx-26f2-8a24-9d30-ad706573714a | jq '.links.notification.href')

bin/acli_task_mon \"${db_copy_task##*/}
bin/acli_task_mon \"${file_copy_task##*/}

I'd love to be able to capture the returned task ID from the acli command WITHIN ROBO but from what I can tell there is no return data returned.

So for example here is the code-switch call in robo:

      $this->_exec('acli api:environments:code-switch ' . $destEnvAlias . ' tags/' . $aTag . ' | jq \'._links.notification.href\'');

Can I get a returned string from the _exec call?

Possibly from: https://github.com/consolidation/robo/blob/4.x/src/Task/Base/Shortcuts.php#L16
or https://github.com/consolidation/robo/blob/4.x/src/Task/Base/Tasks.php#L14
or https://github.com/consolidation/robo/blob/4.x/src/Task/Base/Exec.php#L140

It looks like what I want is in the Result data? or Result message?

But it's not clear exactly how to get the data or message. Can anyone provide an example please?

https://github.com/consolidation/robo/blob/4.x/src/ResultData.php

Thank you.

@danshumaker danshumaker changed the title _exec return code for task capturing?? (Feature Request) How to get _exec return Message & Data for task capturing?? (Feature Request) Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant