Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-22589

hammer command with csv option generates few fields in json format

XMLWordPrintable

    • Sprint 144, Sprint 147
    • Moderate
    • To Do
    • Yes

      Description of problem:
      ----------------------

      When hammer command is used with --csv option to output the data in a single field, for some reason, certain fields are formatted as JSON rather than a single field.

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

      Red Hat Satellite 6.14

      How reproducible:
      ----------------

      Always (easy).

      Steps to Reproduce:
      ------------------

      1. host=myhost.example.com

      2. # hammer --csv host info --name "$host" --fields "Name,Content Information/Content view environments/Content view/Name,Content Information/Content view environments/Lifecycle environment/
      Name,Host Collections/Name,Host Group,Operating system/Operating System"

      Actual results:
      --------------

      Name,Host Group,Operating system::Operating System,Content view environments::Content view::1,Content view environments::Lifecycle environment::1
      myhost.example.com,,RedHat 9.2,"

      {""id""=>3, ""name""=>""RHEL8"", ""composite""=>false}","{""id""=>1, ""name""=>""Library""}"



      Expected results:
      ----------------

      The above output should have each field as a single field, and not some in json format



      Additional info:
      ---------------

      - This looks like a regression bug from Satellite Server 6.13 into 6.14, as it works as expected in 6.13, but fails in 6.14.

      - Following are the results from my lab Satellite Servers. Both from 6.13, and from 6.14 -


      1. Red Hat Satellite 6.13 -
      ----------------------


      [root@rhsat613 ~]# host=dhcp130-106.example.com

      [root@rhsat613 ~]# hammer --csv host info --name "$host" --fields "Name,Content Information/Content view environments/Content view/Name,Content Information/Content view environments/Lifecycle environment/
      Name,Host Collections/Name,Host Group,Operating system/Operating System"

      Name,Host Group,Operating system::Operating System
      dhcp130-106.example.com,Test_HG,RedHat 7.9



      2. Red Hat Satellite 6.14 -
      ----------------------


      [root@rhsat614 ~]# host=dhcp130-165.example.com

      [root@rhsat614 ~]# hammer --csv host info --name "$host" --fields "Name,Content Information/Content view environments/Content view/Name,Content Information/Content view environments/Lifecycle environment/Name,Host Collections/Name,Host Group,Operating system/Operating System"

      Name,Host Group,Operating system::Operating System,Content view environments::Content view::1,Content view environments::Lifecycle environment::1
      dhcp130-165.example.com,,RedHat 9.2,"{""id""=>3, ""name""=>""RHEL8"", ""composite""=>false}

      ","

      {""id""=>1, ""name""=>""Library""}

      "

              jira-bugzilla-migration RH Bugzilla Integration
              rhn-support-ajambhul Anand Jambhulkar
              RH Bugzilla Integration RH Bugzilla Integration
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: