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

Support redirecting ecctl deployment create --track output to a file #584

Open
cavokz opened this issue Sep 14, 2022 · 0 comments
Open

Support redirecting ecctl deployment create --track output to a file #584

cavokz opened this issue Sep 14, 2022 · 0 comments

Comments

@cavokz
Copy link

cavokz commented Sep 14, 2022

Overview

I'd like to be able to:

  1. redirect the json output of the create deployment command to a file, for later use
  2. follow on the console the deployment creation with the --track switch

The command I'd like to use and the output I'd like to see:

$ ecctl deployment create ... --track >deployment.json
Deployment [b386f90bf2ad24f9be16ee925b9483e8] - [Elasticsearch][c713a0b512f641ed8f7e464a8c86632d]: running step "wait-until-running" (Plan duration 8.659474s)...
Deployment [b386f90bf2ad24f9be16ee925b9483e8] - [Kibana][3d0cee21278e457e9b486ba02f36ebb1]: running step "wait-until-elasticsearch-is-accessible" (Plan duration 7.281477s)...
Deployment [b386f90bf2ad24f9be16ee925b9483e8] - [Apm][7f7832d0381645b09b9a122f3d9dac22]: running step "wait-until-elasticsearch-is-accessible" (Plan duration 6.08548s)...
...

deployment.json would contain the usual json content with the info of the just created deployment.

Possible Implementation

My suggestion is to write the --track updates to the console standard error, instead of the standard output as it is now and where the json result is also written.

Testing

$ ecctl deployment create ... --track >deployment.json
Deployment [b386f90bf2ad24f9be16ee925b9483e8] - [Elasticsearch][c713a0b512f641ed8f7e464a8c86632d]: running step "wait-until-running" (Plan duration 8.659474s)...
Deployment [b386f90bf2ad24f9be16ee925b9483e8] - [Kibana][3d0cee21278e457e9b486ba02f36ebb1]: running step "wait-until-elasticsearch-is-accessible" (Plan duration 7.281477s)...
Deployment [b386f90bf2ad24f9be16ee925b9483e8] - [Apm][7f7832d0381645b09b9a122f3d9dac22]: running step "wait-until-elasticsearch-is-accessible" (Plan duration 6.08548s)...
...
$ ecctl deployment shutdown --force $(jq -r .id credentials-cloud-stack.json)

Context

I'm building some testing automation for the geneve tool via Makefile and shell scripting.

I can effectively use jq to extract the info I need from the captured output, with the minor annoyance of jq complaining for non-json garbage at the end of the file (the deployment creation tracking).

More annoying instead is that if I redirect the output to a file, I cannot see the creation progress.

Workaround

$ ecctl deployment create --file $DEPLOYMENT_FILE --track | tee /dev/stderr | (jq >$CREDS_FILE 2>/dev/null; cat >/dev/null)

Your Environment

Makefile and shell script automation on macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant