Project

General

Profile

Bug #24980

Single reference fields are wrongly rendered in yaml and json

Added by Tomáš Strachota over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Hammer core
Target version:
-
Fixed in Releases:
Found in Releases:
In Kanboard:
Red Hat JIRA:

Description

When there's a single reference in command's output definition, yaml and json output adapters print the whole root data structure in place of the reference field.

For example:

field nil, _("Domain"), Fields::SingleReference, :key => :domain

prints:

hammer --output=json hostgroup info --id 1                                                                                                                               
{
  "ID": 1,
  "NAME": "Provisioning",
  "TITLE": "Provisioning",
  "NETWORK": {
    "DOMAIN": {
      "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": 1,
      "SUBNET_NAME": "tstracho-laptop",
      "OPERATINGSYSTEM_ID": 3,
      "OPERATINGSYSTEM_NAME": "CentOS 7",
      "DOMAIN_ID": 1,
      "DOMAIN_NAME": "tstracho-laptop",
      "ENVIRONMENT_ID": null,
      "ENVIRONMENT_NAME": null,
      "COMPUTE_PROFILE_ID": null,
      "COMPUTE_PROFILE_NAME": null,
      "ANCESTRY": null,
      "PARENT_ID": null,
      "PARENT_NAME": null,
      "PTABLE_ID": 87,
      "PTABLE_NAME": "Kickstart default",
      "MEDIUM_ID": 9,
      "MEDIUM_NAME": "CentOS Czech mirror",
      "PXE_LOADER": null,
      "SUBNET6_ID": null,
      "SUBNET6_NAME": null,
      "ARCHITECTURE_ID": 1,
      "ARCHITECTURE_NAME": "x86_64",
      "REALM_ID": null,
      "REALM_NAME": null,
      "CREATED_AT": "2018-01-24 12:22:29 -1100",
      "UPDATED_AT": "2018-01-24 12:22:29 -1100",
...

Expected behavior:
JSON and YAML adaptera should print the same fields as the base adapter.
Fixing this might require implementation of formatters specific to certain adapters.


Related issues

Related to Hammer CLI - Tracker #14914: Tracker for output related issuesClosed

Associated revisions

Revision 70799cb0 (diff)
Added by Rahul Bajaj over 4 years ago

Fixes #24980 - enable formatters in json structured output (#288)

Revision bf1cde12 (diff)
Added by Rahul Bajaj over 4 years ago

Fixes #24980 - enable structured formatters for refernces.

History

#1 Updated by Tomáš Strachota over 4 years ago

#2 Updated by Tomáš Strachota over 4 years ago

  • Description updated (diff)

#3 Updated by Oleh Fedorenko over 4 years ago

  • Assignee set to Oleh Fedorenko
  • Status changed from New to Assigned

#4 Updated by The Foreman Bot over 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli/pull/287 added

#5 Updated by The Foreman Bot over 4 years ago

  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/389 added

#6 Updated by Tomáš Strachota over 4 years ago

  • Bugzilla link set to 1596504

#7 Updated by Tomáš Strachota over 4 years ago

  • Assignee changed from Oleh Fedorenko to Rahul Bajaj
  • Status changed from Ready For Testing to Assigned
  • Pull request deleted (https://github.com/theforeman/hammer-cli/pull/287, https://github.com/theforeman/hammer-cli-foreman/pull/389)

#8 Updated by The Foreman Bot over 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli/pull/288 added

#9 Updated by The Foreman Bot over 4 years ago

  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/390 added

#10 Updated by Rahul Bajaj over 4 years ago

  • Status changed from Ready For Testing to Closed

#11 Updated by Martin Bacovsky over 3 years ago

  • Fixed in Releases hammer-cli-0.15.0 added

Also available in: Atom PDF