Bug 1253820 - Hammer JSON output uses inconsistent capitalization
Summary: Hammer JSON output uses inconsistent capitalization
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: jcallaha
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-14 19:36 UTC by jcallaha
Modified: 2019-09-25 21:16 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-06 23:18:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 17010 0 None None None 2016-10-19 11:45:29 UTC

Description jcallaha 2015-08-14 19:36:09 UTC
Description of problem:
Hammer returns inconsistent capitalization in its json output. For example, a user trying to parse the id's in an output may have to handle 'ID', 'Id', and 'id'.

Version-Release number of selected component (if applicable):
Satellite 6.1 GA

How reproducible:
Always

Steps to Reproduce:
1. run one of the two commands detailed in Additional Info, or your own choice.
2. run at least one more command
3. Check consistency for returned keys

Actual results:
keys are inconsistently capitalized

Expected results:
keys are inconsistently capitalized. I prefer lowercase for ease

Additional info:
hammer --output=json organization info --id="31"
{
  "Id": 31,
  "Name": "KVybjk",
  "Users": [

  ],
  "Smart proxies": [
    {
      "name": "rhsm-qe-1.rhq.lab.eng.bos.redhat.com",
      "id": 1,
      "url": "https://rhsm-qe-1.rhq.lab.eng.bos.redhat.com:9090"
    }
...
  "Templates": [
    {
      "id": 44,
      "name": "Boot disk iPXE - generic host",
      "template_kind_id": 1,
      "template_kind_name": "Bootdisk"
    },


hammer -v -u --output=json activation-key info --id="57"
{
  "Name": "rI6jNBJVaR",
  "ID": 57,
  "Description": null,
  "Content Host Limit": "Unlimited",
  "Auto Attach": true,
  "Lifecycle Environment": null,
  "Content View": null,
  "Host Collections": {
  }
}

Comment 1 jcallaha 2015-08-19 15:03:59 UTC
Additionally, following the same naming conventions used in the API would be a smart choice. Since most of the JSON output is going to be parsed by machines, it makes sense to have our customers expect the same output between API and CLI.

Comment 3 Adam Ruzicka 2016-10-19 11:45:28 UTC
Created redmine issue http://projects.theforeman.org/issues/17010 from this bug

Comment 4 Bryan Kearney 2017-03-06 23:18:20 UTC
An upstream issue for this has been created. When this is fixed, the next version of Satellite will carry the fix. We will no longer track this downstream.


Note You need to log in before you can comment on or make changes to this bug.