Skip to content

salt-cloud --out json output is not usable #14725

Closed

Description

@whiteinge

When provisioning VMs salt-cloud --out json interleaves JSON and the bootstrap output all to stdout which makes it impossible to consume via scripts -- you can't know where the logging/bootstrap output stops and where JSON begins.

Activity

  1. added this to the Approved milestone on Aug 4, 2014
  2. techhat commented on Aug 4, 2014

    @techhat
    Contributor

    @s0undt3ch should SSH output be changed to STDERR? Maybe change it to use the logger?

  3. whiteinge commented on Aug 4, 2014

    @whiteinge
    ContributorAuthor

    Good to know. Thanks.

  4. s0undt3ch commented on Aug 4, 2014

    @s0undt3ch
    Contributor

    I'd be against packing all ssh output into stderr. I believe whatever comes on stdout should be on stdout and the same for stderr.
    So, I believe this is not a bug.
    However, I would not be against exposing display_ssh_output to the parsers code by adding support for --hide-ssh-output.

    Would this do it?

  5. whiteinge commented on Aug 4, 2014

    @whiteinge
    ContributorAuthor

    If so would we set that option automatically for --out=json?

    We could capture stdout/stderr and add it to the return data structure as
    stout/stderr fields. Or have that as an opt-in flag.

    I'm ok with either solution but if --out=json returns non-json it's a bug.

  6. s0undt3ch commented on Aug 5, 2014

    @s0undt3ch
    Contributor

    hmm, we could auto hide it if --out is not set to it's default and still show it by adding and using --show-ssh-output?

  7. whiteinge commented on Aug 5, 2014

    @whiteinge
    ContributorAuthor

    After sleeping on it, I'd like to keep the display_ssh_output option as-is (maybe add a CLI flag for it). Then based on that setting collect stdout/stderr into a var and include it in the actual returned data structure. That way the output format doesn't matter. I don't know what's involved in making that change but I'll try to find some time to dive into it myself.

  8. added
    Feature
    and removed
    bug
    severity-low
    on May 19, 2015
  9. added
    RIoT
    on Jun 9, 2015
  10. bogdanr commented on Nov 23, 2015

    @bogdanr
    Contributor

    I am also experiencing this problem on 2015.8.1-121-gc1ac330

    ~# salt-cloud -m /etc/salt/cloud.environments.d/gigi1-app-dev.map -y --out=json
    [INFO    ] salt-cloud starting
    [INFO    ] Applying map from '/etc/salt/cloud.environments.d/gigi1-app-dev.map'.
    [INFO    ] Starting new HTTPS connection (1): api.digitalocean.com
    [INFO    ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
    [INFO    ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
    [INFO    ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
    [INFO    ] Calculating dependencies for gigi1-app-dev-web2
    [INFO    ] Calculating dependencies for gigi1-app-dev-web1
    [INFO    ] Creating Cloud VM gigi1-app-dev-web2 in eu-west-1
    [INFO    ] Starting new HTTPS connection (1): ec2.eu-west-1.amazonaws.com
    [INFO    ] Starting new HTTPS connection (1): ec2.eu-west-1.amazonaws.com
    [INFO    ] Starting new HTTPS connection (1): ec2.eu-west-1.amazonaws.com
    [INFO    ] Starting new HTTPS connection (1): ec2.eu-west-1.amazonaws.com
    [INFO    ] Created node gigi1-app-dev-web2
    [INFO    ] Salt node data. Public_ip: 52.31.202.167
    .
    .
    .
    .
    { some json appears much later }
    

    Indeed the output is not usable as json in any circumstance.
    In my opinion the error log should also be parsed as json when that option is used and the --static parameter should be implemented for salt-cloud and it should be implicit.

  11. stale commented on Feb 10, 2018

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

    If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRIoTSalt-Cloudstale

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions