Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1596504 - hammer hostgroup info --output json returns json including non unique keys
Summary: hammer hostgroup info --output json returns json including non unique keys
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Host Group
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.5.0
Assignee: Anurag Patel
QA Contact: Mirek Długosz
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-29 07:11 UTC by Ales Dujicek
Modified: 2019-11-05 22:29 UTC (History)
9 users (show)

Fixed In Version: tfm-rubygem-hammer_cli_foreman-0.15.0-1,tfm-rubygem-hammer_cli-0.15.0-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1646733 (view as bug list)
Environment:
Last Closed: 2019-05-14 12:37:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 23238 0 None None None 2018-06-29 07:11:17 UTC
Foreman Issue Tracker 24980 0 None None None 2018-09-21 09:21:59 UTC
Red Hat Product Errata RHSA-2019:1222 0 None None None 2019-05-14 12:37:34 UTC

Internal Links: 1699040

Description Ales Dujicek 2018-06-29 07:11:14 UTC
there is "Operating System" twice and they contain different data
so one of them is lost if you parse it

<pre>
# hammer --output json -v -u admin -p changeme  hostgroup info --id="36"
{
  "Id": 36,
  "Name": "6lLfrO",
  "Title": "6lLfrO",
  "Operating System": {
    "content_source_id": 1,
    "content_source_name": "foreman.redhat.com",
    "content_view_id": 371,
  },
  "Puppet CA Proxy": {
    "content_source_id": 1,
    "content_source_name": "foreman.redhat.com",
    "content_view_id": 371,
  },
  "Puppet Master Proxy": {
  },
  "Network": {
  },
  "Operating system": {
    "Architecture": {
      "content_source_id": 1,
      "content_source_name": "foreman.redhat.com",
      "content_view_id": 371
    }
  },
  "Puppetclasses": [
  ],
  "Parameters": [
    null
  ],
  "Organizations": [
  ],
  "OpenSCAP Proxy": null,
  "Content View": {
    "ID": 371,
    "Name": "SQyJYkoRsU"
  },
  "Lifecycle Environment": {
    "ID": 265,
    "Name": "rjPGjE"
  },
  "Content Source": {
    "ID": 1,
    "Name": "sforeman.redhat.com"
  },
  "Kickstart Repository": {
    "ID": 566,
    "Name": "NSZjjWCFkVaaVuF"
  }
}
</pre>

foreman-1.18.0-0.develop.201804061848git210e295.el7.noarch
tfm-rubygem-hammer_cli-0.13.pre.develop-1.201803232224gite493035.el7.noarch

Comment 1 Ales Dujicek 2018-06-29 07:11:19 UTC
Created from redmine issue http://projects.theforeman.org/issues/23238

Comment 2 Ales Dujicek 2018-06-29 07:11:23 UTC
Upstream bug assigned to None

Comment 4 Ales Dujicek 2018-06-29 07:16:25 UTC
just a note, it is kind of unique, once lower case, once upper case (s/System)
"Operating System"
"Operating system"

but still, it does not make much sense to have it there twice..

Comment 5 Jan Hutař 2018-06-29 07:35:43 UTC
6.3.0 do not have this kind of duplicity:

[root@host-8-250-186 ~]# hammer --output json hostgroup info --id 1
{
  "Id": 1,
  "Name": "jhutar-delme",
  "Title": "jhutar-delme",
  "Operating System": {
    "content_source_id": null,
    "content_source_name": null,
    "content_view_id": null,
    "content_view_name": null,
    "lifecycle_environment_id": null,
    "lifecycle_environment_name": null,
    "kickstart_repository_id": null,
    "subnet_id": null,
    "subnet_name": null,
    "operatingsystem_id": 1,
    "operatingsystem_name": "RedHat 7.5",
    "domain_id": null,
    "domain_name": null,
    "environment_id": null,
    "environment_name": null,
    "compute_profile_id": null,
    "compute_profile_name": null,
    "ancestry": null,
    "parent_id": null,
    "parent_name": null,
    "ptable_id": 90,
    "ptable_name": "Kickstart default",
    "medium_id": null,
    "medium_name": null,
    "pxe_loader": "PXELinux BIOS",
    "architecture_id": 1,
    "architecture_name": "x86_64",
    "realm_id": null,
    "realm_name": null,
    "created_at": "2018-06-29 07:01:41 UTC",
    "updated_at": "2018-06-29 07:01:41 UTC",
    "id": 1,
    "name": "jhutar-delme",
    "title": "jhutar-delme",
    "puppet_proxy_id": null,
    "puppet_proxy_name": null,
    "puppet_ca_proxy_id": null,
    "puppet_ca_proxy_name": null,
    "openscap_proxy_id": null,
    "openscap_proxy_name": null,
    "puppet_proxy": null,
    "puppet_ca_proxy": null,
    "openscap_proxy": null,
    "template_combinations": [

    ],
    "puppetclasses": [

    ],
    "config_groups": [

    ],
    "parameters": [

    ],
    "all_puppetclasses": [

    ],
    "locations": [

    ],
    "organizations": [

    ]
  },
  "Architecture": {
    "content_source_id": null,
    "content_source_name": null,
    "content_view_id": null,
    "content_view_name": null,
    "lifecycle_environment_id": null,
    "lifecycle_environment_name": null,
    "kickstart_repository_id": null,
    "subnet_id": null,
    "subnet_name": null,
    "operatingsystem_id": 1,
    "operatingsystem_name": "RedHat 7.5",
    "domain_id": null,
    "domain_name": null,
    "environment_id": null,
    "environment_name": null,
    "compute_profile_id": null,
    "compute_profile_name": null,
    "ancestry": null,
    "parent_id": null,
    "parent_name": null,
    "ptable_id": 90,
    "ptable_name": "Kickstart default",
    "medium_id": null,
    "medium_name": null,
    "pxe_loader": "PXELinux BIOS",
    "architecture_id": 1,
    "architecture_name": "x86_64",
    "realm_id": null,
    "realm_name": null,
    "created_at": "2018-06-29 07:01:41 UTC",
    "updated_at": "2018-06-29 07:01:41 UTC",
    "id": 1,
    "name": "jhutar-delme",
    "title": "jhutar-delme",
    "puppet_proxy_id": null,
    "puppet_proxy_name": null,
    "puppet_ca_proxy_id": null,
    "puppet_ca_proxy_name": null,
    "openscap_proxy_id": null,
    "openscap_proxy_name": null,
    "puppet_proxy": null,
    "puppet_ca_proxy": null,
    "openscap_proxy": null,
    "template_combinations": [

    ],
    "puppetclasses": [

    ],
    "config_groups": [

    ],
    "parameters": [

    ],
    "all_puppetclasses": [

    ],
    "locations": [

    ],
    "organizations": [

    ]
  },
  "Partition Table": {
    "content_source_id": null,
    "content_source_name": null,
    "content_view_id": null,
    "content_view_name": null,
    "lifecycle_environment_id": null,
    "lifecycle_environment_name": null,
    "kickstart_repository_id": null,
    "subnet_id": null,
    "subnet_name": null,
    "operatingsystem_id": 1,
    "operatingsystem_name": "RedHat 7.5",
    "domain_id": null,
    "domain_name": null,
    "environment_id": null,
    "environment_name": null,
    "compute_profile_id": null,
    "compute_profile_name": null,
    "ancestry": null,
    "parent_id": null,
    "parent_name": null,
    "ptable_id": 90,
    "ptable_name": "Kickstart default",
    "medium_id": null,
    "medium_name": null,
    "pxe_loader": "PXELinux BIOS",
    "architecture_id": 1,
    "architecture_name": "x86_64",
    "realm_id": null,
    "realm_name": null,
    "created_at": "2018-06-29 07:01:41 UTC",
    "updated_at": "2018-06-29 07:01:41 UTC",
    "id": 1,
    "name": "jhutar-delme",
    "title": "jhutar-delme",
    "puppet_proxy_id": null,
    "puppet_proxy_name": null,
    "puppet_ca_proxy_id": null,
    "puppet_ca_proxy_name": null,
    "openscap_proxy_id": null,
    "openscap_proxy_name": null,
    "puppet_proxy": null,
    "puppet_ca_proxy": null,
    "openscap_proxy": null,
    "template_combinations": [

    ],
    "puppetclasses": [

    ],
    "config_groups": [

    ],
    "parameters": [

    ],
    "all_puppetclasses": [

    ],
    "locations": [

    ],
    "organizations": [

    ]
  },
  "Puppet CA Proxy Id": null,
  "Puppet Master Proxy Id": null,
  "Puppetclasses": [

  ],
  "Parameters": [

  ],
  "Parent Id": null,
  "OpenSCAP Proxy": null,
  "Content View": {
    "ID": null,
    "Name": null
  },
  "Lifecycle Environment": {
    "ID": null,
    "Name": null
  },
  "Content Source": {
    "ID": null,
    "Name": null
  },
  "Kickstart Repository": {
    "ID": null,
    "Name": null
  }
}
[root@host-8-250-186 ~]# rpm -qa | grep hammer | sort
tfm-rubygem-hammer_cli-0.11.0.1-1.el7sat.noarch
tfm-rubygem-hammer_cli_csv-2.3.1-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-0.11.0.5-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_admin-0.0.8-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3.3-2.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_discovery-1.0.0-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.6-2.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_openscap-0.1.5-1.fm1_15.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_remote_execution-0.0.6-1.fm1_15.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.12-1.fm1_15.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_virt_who_configure-0.0.3-1.el7sat.noarch
tfm-rubygem-hammer_cli_katello-0.11.3.5-1.el7sat.noarch

Comment 6 Jan Hutař 2018-06-29 07:38:15 UTC
This is in current downstream snapshots as well:

[root@sat640snap9 ~]# hammer --output json -u admin -p changeme hostgroup info --id 23
{
  "Id": 23,
  "Name": "jhutar-delme",
  "Title": "jhutar-delme",
  "Operating System": {
    "content_source_id": null,
    "content_source_name": null,
    "content_view_id": null,
    "content_view_name": null,
    "lifecycle_environment_id": null,
    "lifecycle_environment_name": null,
    "kickstart_repository_id": null,
    "kickstart_repository_name": null,
    "subnet_id": null,
    "subnet_name": null,
    "operatingsystem_id": 1,
    "operatingsystem_name": "RedHat 7.5",
    "domain_id": null,
    "domain_name": null,
    "environment_id": null,
    "environment_name": null,
    "compute_profile_id": null,
    "compute_profile_name": null,
    "ancestry": null,
    "parent_id": null,
    "parent_name": null,
    "ptable_id": 94,
    "ptable_name": "Kickstart default",
    "medium_id": null,
    "medium_name": null,
    "pxe_loader": "Grub2 UEFI",
    "subnet6_id": null,
    "subnet6_name": null,
    "architecture_id": 1,
    "architecture_name": "x86_64",
    "realm_id": null,
    "realm_name": null,
    "created_at": "2018-06-29 07:36:47 UTC",
    "updated_at": "2018-06-29 07:36:47 UTC",
    "id": 23,
    "name": "jhutar-delme",
    "title": "jhutar-delme",
    "description": "",
    "puppet_proxy_id": null,
    "puppet_proxy_name": null,
    "puppet_ca_proxy_id": null,
    "puppet_ca_proxy_name": null,
    "openscap_proxy_id": null,
    "openscap_proxy_name": null,
    "puppet_proxy": null,
    "puppet_ca_proxy": null,
    "openscap_proxy": null,
    "template_combinations": [

    ],
    "puppetclasses": [

    ],
    "config_groups": [

    ],
    "all_puppetclasses": [

    ],
    "locations": [

    ],
    "organizations": [
      {
        "id": 1,
        "name": "Default Organization",
        "title": "Default Organization",
        "description": null
      }
    ]
  },
  "Description": "",
  "Network": {
  },
  "Operating system": {
    "Architecture": {
      "content_source_id": null,
      "content_source_name": null,
      "content_view_id": null,
      "content_view_name": null,
      "lifecycle_environment_id": null,
      "lifecycle_environment_name": null,
      "kickstart_repository_id": null,
      "kickstart_repository_name": null,
      "subnet_id": null,
      "subnet_name": null,
      "operatingsystem_id": 1,
      "operatingsystem_name": "RedHat 7.5",
      "domain_id": null,
      "domain_name": null,
      "environment_id": null,
      "environment_name": null,
      "compute_profile_id": null,
      "compute_profile_name": null,
      "ancestry": null,
      "parent_id": null,
      "parent_name": null,
      "ptable_id": 94,
      "ptable_name": "Kickstart default",
      "medium_id": null,
      "medium_name": null,
      "pxe_loader": "Grub2 UEFI",
      "subnet6_id": null,
      "subnet6_name": null,
      "architecture_id": 1,
      "architecture_name": "x86_64",
      "realm_id": null,
      "realm_name": null,
      "created_at": "2018-06-29 07:36:47 UTC",
      "updated_at": "2018-06-29 07:36:47 UTC",
      "id": 23,
      "name": "jhutar-delme",
      "title": "jhutar-delme",
      "description": "",
      "puppet_proxy_id": null,
      "puppet_proxy_name": null,
      "puppet_ca_proxy_id": null,
      "puppet_ca_proxy_name": null,
      "openscap_proxy_id": null,
      "openscap_proxy_name": null,
      "puppet_proxy": null,
      "puppet_ca_proxy": null,
      "openscap_proxy": null,
      "template_combinations": [

      ],
      "puppetclasses": [

      ],
      "config_groups": [

      ],
      "all_puppetclasses": [

      ],
      "locations": [

      ],
      "organizations": [
        {
          "id": 1,
          "name": "Default Organization",
          "title": "Default Organization",
          "description": null
        }
      ]
    },
    "Operating System": {
      "content_source_id": null,
      "content_source_name": null,
      "content_view_id": null,
      "content_view_name": null,
      "lifecycle_environment_id": null,
      "lifecycle_environment_name": null,
      "kickstart_repository_id": null,
      "kickstart_repository_name": null,
      "subnet_id": null,
      "subnet_name": null,
      "operatingsystem_id": 1,
      "operatingsystem_name": "RedHat 7.5",
      "domain_id": null,
      "domain_name": null,
      "environment_id": null,
      "environment_name": null,
      "compute_profile_id": null,
      "compute_profile_name": null,
      "ancestry": null,
      "parent_id": null,
      "parent_name": null,
      "ptable_id": 94,
      "ptable_name": "Kickstart default",
      "medium_id": null,
      "medium_name": null,
      "pxe_loader": "Grub2 UEFI",
      "subnet6_id": null,
      "subnet6_name": null,
      "architecture_id": 1,
      "architecture_name": "x86_64",
      "realm_id": null,
      "realm_name": null,
      "created_at": "2018-06-29 07:36:47 UTC",
      "updated_at": "2018-06-29 07:36:47 UTC",
      "id": 23,
      "name": "jhutar-delme",
      "title": "jhutar-delme",
      "description": "",
      "puppet_proxy_id": null,
      "puppet_proxy_name": null,
      "puppet_ca_proxy_id": null,
      "puppet_ca_proxy_name": null,
      "openscap_proxy_id": null,
      "openscap_proxy_name": null,
      "puppet_proxy": null,
      "puppet_ca_proxy": null,
      "openscap_proxy": null,
      "template_combinations": [

      ],
      "puppetclasses": [

      ],
      "config_groups": [

      ],
      "all_puppetclasses": [

      ],
      "locations": [

      ],
      "organizations": [
        {
          "id": 1,
          "name": "Default Organization",
          "title": "Default Organization",
          "description": null
        }
      ]
    },
    "Partition Table": {
      "content_source_id": null,
      "content_source_name": null,
      "content_view_id": null,
      "content_view_name": null,
      "lifecycle_environment_id": null,
      "lifecycle_environment_name": null,
      "kickstart_repository_id": null,
      "kickstart_repository_name": null,
      "subnet_id": null,
      "subnet_name": null,
      "operatingsystem_id": 1,
      "operatingsystem_name": "RedHat 7.5",
      "domain_id": null,
      "domain_name": null,
      "environment_id": null,
      "environment_name": null,
      "compute_profile_id": null,
      "compute_profile_name": null,
      "ancestry": null,
      "parent_id": null,
      "parent_name": null,
      "ptable_id": 94,
      "ptable_name": "Kickstart default",
      "medium_id": null,
      "medium_name": null,
      "pxe_loader": "Grub2 UEFI",
      "subnet6_id": null,
      "subnet6_name": null,
      "architecture_id": 1,
      "architecture_name": "x86_64",
      "realm_id": null,
      "realm_name": null,
      "created_at": "2018-06-29 07:36:47 UTC",
      "updated_at": "2018-06-29 07:36:47 UTC",
      "id": 23,
      "name": "jhutar-delme",
      "title": "jhutar-delme",
      "description": "",
      "puppet_proxy_id": null,
      "puppet_proxy_name": null,
      "puppet_ca_proxy_id": null,
      "puppet_ca_proxy_name": null,
      "openscap_proxy_id": null,
      "openscap_proxy_name": null,
      "puppet_proxy": null,
      "puppet_ca_proxy": null,
      "openscap_proxy": null,
      "template_combinations": [

      ],
      "puppetclasses": [

      ],
      "config_groups": [

      ],
      "all_puppetclasses": [

      ],
      "locations": [

      ],
      "organizations": [
        {
          "id": 1,
          "name": "Default Organization",
          "title": "Default Organization",
          "description": null
        }
      ]
    },
    "PXE Loader": "Grub2 UEFI"
  },
  "Puppetclasses": [

  ],
  "Parameters": [
    null
  ],
  "Organizations": [
    {
      "id": 1,
      "name": "Default Organization",
      "title": "Default Organization",
      "description": null
    }
  ],
  "OpenSCAP Proxy": null,
  "Content View": {
    "ID": null,
    "Name": null
  },
  "Lifecycle Environment": {
    "ID": null,
    "Name": null
  },
  "Content Source": {
    "ID": null,
    "Name": null
  },
  "Kickstart Repository": {
    "ID": null,
    "Name": null
  }
}
[root@sat640snap9 ~]# rpm -qa | grep hammer | sort
tfm-rubygem-hammer_cli-0.13.0-1.el7sat.noarch
tfm-rubygem-hammer_cli_csv-2.3.1-2.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-0.13.0-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_admin-0.0.8-2.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3.3-3.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_discovery-1.0.0-2.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.6-3.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_openscap-0.1.6-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_remote_execution-0.0.6-2.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.12-2.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_templates-0.1.0-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_virt_who_configure-0.0.3-2.el7sat.noarch
tfm-rubygem-hammer_cli_katello-0.13.1-1.el7sat.noarch

Comment 13 Rahul Bajaj 2018-09-21 07:45:40 UTC
Hello,

Looking at the issue, i have found out the following:

a) The data loaded from the api is correct and has no duplicate,
so the change has to occur on the hammer side.

b) The data in both 'Operating System' and 'Operating system' is
consistent as there is only one request being made so the data is
consistent in both of them.

Comment 14 Rahul Bajaj 2018-09-21 08:32:54 UTC
Hello,

Digging a little deeper, i found out that there are no 
duplicate values but nesting involved here:

```

- Operating system : {
    + Architecture: {51},
    + Operating System: {51},
    + Partition Table: {51},
      PXE Loader: "PXELINUX BIOS",
  },

```

After talking to Tomas, we figured out the real issue is with 
the output adapters.
Tomas explained that the output adapters basically don't apply
to json and yaml, thus we are facing this issue.

Comment 15 Anurag Patel 2018-09-21 09:22:00 UTC
Upstream ticket for the underlying issue: https://projects.theforeman.org/issues/24980

Comment 17 Rahul Bajaj 2018-09-26 11:37:20 UTC
This issue is fixed in the upstream now:

the related prs are:
1) https://github.com/theforeman/hammer-cli-foreman/pull/390
2) https://github.com/theforeman/hammer-cli/pull/288

Thanks Tomas and Martin for the help :)

Comment 22 errata-xmlrpc 2019-05-14 12:37:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222


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