Bug 1283793

Summary: Help JSON output should be truly JSON formatted
Product: Red Hat Satellite Reporter: jcallaha
Component: HammerAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: jcallaha
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.4CC: bkearney
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/12589
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-11 21:47:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jcallaha 2015-11-19 21:56:20 UTC
Description of problem:
If a user request JSON-formatted help output from hammer, they are given all useful information as one large string within one "message" tag. The user would then have to parse that string to separate the useful information. If the output was already separated into a true JSON format, no additional processing would be needed and is already very useful.

Version-Release number of selected component (if applicable):
Nightly

How reproducible:
Always

Steps to Reproduce:
1. hammer --output=json host --help

Actual results:
{
  "message": "Usage:\n    hammer host [OPTIONS] SUBCOMMAND [ARG] ...\n\nParameters:\n SUBCOMMAND                    subcommand\n [ARG] ...                     subcommand arguments\n\nSubcommands:\n create                        Create a host\n delete                        Delete a host\n delete-parameter              Delete parameter for a host.\n facts                         List all fact values\n info                          Show a host\n interface                     View and manage host's network interfaces\n list                          List all hosts\n puppet-classes                List all Puppet classes\n puppetrun                     Force a Puppet agent run on the host\n reboot                        Reboot a host\n reports                       List all reports\n sc-params                     List all smart class parameters\n set-parameter                 Create or update parameter for a host.\n smart-variables               List all smart variables\n start                         Power a host on\n status                        Get configuration status of host\n stop                          Power a host off\n update                        Update a host\n\nOptions:\n -h, --help                    print help\n"
}

Expected results:
Something like
{
    "Usage": "hammer host [OPTIONS] SUBCOMMAND [ARG] ...",
    "Parameters": {
        "SUBCOMMAND": "subcommand",
        "[ARG] ...": "subcommand arguments"
    },
    "Subcommands": {
        "create": "Create a host",
        "delete": "Delete a host",
        "delete-parameter": "Delete parameter for a host.",
        "facts": "List all fact values",
        "info": "Show a host",
        "interface": "View and manage host's network interfaces",
        "list": "List all hosts",
        "puppet-classes": "List all Puppet classes",
        "puppetrun": "Force a Puppet agent run on the host",
        "reboot": "Reboot a host",
        "reports": "List all reports",
        "sc-params": "List all smart class parameters",
        "set-parameter": "Create or update parameter for a host.",
        "smart-variables": "List all smart variables",
        "start": "Power a host on",
        "status": "Get configuration status of host",
        "stop": "Power a host off",
        "update": "Update a host"
    }
}

Comment 1 Bryan Kearney 2015-11-24 16:17:59 UTC
Created redmine issue http://projects.theforeman.org/issues/12589 from this bug

Comment 2 Bryan Kearney 2016-07-26 19:09:59 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 3 Bryan Kearney 2017-01-11 21:47:48 UTC
This is an older bug which has been reported upstream. We are not going to track this bug downstream. When the upstream issue is resolved, the next build will contain the fix. Thank you.