Skip to content

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

@cavokz

Description

@cavokz

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions