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

hammer subscription content-override applies the change to all repository sets

XMLWordPrintable

    • None
    • None
    • None
    • To Do

      Description of problem:
      An attempt to change (via hammer) one Repository Set enabled on a Host does alter the setting for all Repository Sets.

      Example:

      hammer> host subscription product-content --content-access-mode-all 1 --host-id 2
      ----|-----------------------------------------------------------|-------------------------------------------------|----------------|---------
      ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
      ----|-----------------------------------------------------------|-------------------------------------------------|----------------|---------
      6401 | Red Hat Ansible Engine 2 for RHEL 8 x86_64 (RPMs) | ansible-2-for-rhel-8-x86_64-rpms | no |
      371 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) | rhel-8-for-x86_64-appstream-rpms | yes |
      440 | Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) | rhel-8-for-x86_64-baseos-rpms | yes |
      364 | Red Hat Satellite Client 6 for RHEL 8 x86_64 (RPMs) | satellite-client-6-for-rhel-8-x86_64-rpms | no |
      hammer>

      being changed via:

      hammer> host subscription content-override --content-label satellite-client-6-for-rhel-8-x86_64-rpms --enabled true --value 1 --host-id 2
      Updated content override.

      applies the change to everything :

      hammer> host subscription product-content --content-access-mode-all 1 --host-id 2
      ----|-----------------------------------------------------------|-------------------------------------------------|----------------|---------
      ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
      ----|-----------------------------------------------------------|-------------------------------------------------|----------------|---------
      6401 | Red Hat Ansible Engine 2 for RHEL 8 x86_64 (RPMs) | ansible-2-for-rhel-8-x86_64-rpms | no | enabled:1
      371 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) | rhel-8-for-x86_64-appstream-rpms | yes | enabled:1
      440 | Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) | rhel-8-for-x86_64-baseos-rpms | yes | enabled:1
      364 | Red Hat Satellite Client 6 for RHEL 8 x86_64 (RPMs) | satellite-client-6-for-rhel-8-x86_64-rpms | no | enabled:1
      hammer>

      The reason is hidden in parameters hammer used:

      2023-10-17T12:45:14 [I|app|eb7ad4a2] Started PUT "/api/hosts/2/subscriptions/content_override" for 1.2.3.4 at 2023-10-17 12:45:14 +0200
      2023-10-17T12:45:14 [I|app|eb7ad4a2] Processing by Katello::Api::V2::HostSubscriptionsController#content_override as JSON
      2023-10-17T12:45:14 [I|app|eb7ad4a2] Parameters: {"content_overrides_search"=>

      {"enabled"=>true}, "content_overrides"=>[{"content_label"=>"satellite-client-6-for-rhel-8-x86_64-rpms", "value"=>"[FILTERED]", "name"=>"enabled"}], "api_version"=>"v2", "host_id"=>"2", "host_subscription"=>{"content_overrides_search"=>{"enabled"=>true}

      , "content_overrides"=>[

      {"content_label"=>"satellite-client-6-for-rhel-8-x86_64-rpms", "value"=>"[FILTERED]", "name"=>"enabled"}]}}

      So any repository set matching the filter in content_overrides_search will be changed.

      OK, maybe this is just a hammer UX bug and hammer assumes --search option to be extra used? (already an UX bug I would say since --content-label is mandatory option so why to provide the same info "I wanna scope the change to .." also somewhere else?). So let reset everything and retry:

      hammer> host subscription product-content --content-access-mode-all 1 --host-id 2
      ----|-----------------------------------------------------------|-------------------------------------------------|----------------|---------
      ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
      ----|-----------------------------------------------------------|-------------------------------------------------|----------------|---------
      6401 | Red Hat Ansible Engine 2 for RHEL 8 x86_64 (RPMs) | ansible-2-for-rhel-8-x86_64-rpms | no |
      371 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) | rhel-8-for-x86_64-appstream-rpms | yes |
      440 | Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) | rhel-8-for-x86_64-baseos-rpms | yes |
      364 | Red Hat Satellite Client 6 for RHEL 8 x86_64 (RPMs) | satellite-client-6-for-rhel-8-x86_64-rpms | no |
      hammer>
      hammer> host subscription content-override --content-label satellite-client-6-for-rhel-8-x86_64-rpms --enabled true --value 1 --host-id 2 --search "label = satellite-client-6-for-rhel-8-x86_64-rpms"
      Updated content override.
      hammer>
      hammer> host subscription product-content --content-access-mode-all 1 --host-id 2
      ----|-----------------------------------------------------------|-------------------------------------------------|----------------|---------
      ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
      ----|-----------------------------------------------------------|-------------------------------------------------|----------------|---------
      6401 | Red Hat Ansible Engine 2 for RHEL 8 x86_64 (RPMs) | ansible-2-for-rhel-8-x86_64-rpms | no |
      371 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) | rhel-8-for-x86_64-appstream-rpms | yes |
      440 | Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) | rhel-8-for-x86_64-baseos-rpms | yes |
      364 | Red Hat Satellite Client 6 for RHEL 8 x86_64 (RPMs) | satellite-client-6-for-rhel-8-x86_64-rpms | no | enabled:1
      hammer>

      with parameters used:

      2023-10-17T12:48:48 [I|app|1059352e] Started PUT "/api/hosts/2/subscriptions/content_override" for 1.2.3.4 at 2023-10-17 12:48:48 +0200
      2023-10-17T12:48:48 [I|app|1059352e] Processing by Katello::Api::V2::HostSubscriptionsController#content_override as JSON
      2023-10-17T12:48:48 [I|app|1059352e] Parameters: {"content_overrides_search"=>{"search"=>"label = satellite-client-6-for-rhel-8-x86_64-rpms", "enabled"=>true}, "content_overrides"=>[{"content_label"=>"satellite-client-6-for-rhel-8-x86_64-rpms", "value"=>"[FILTERED]", "name"=>"enabled"}

      ], "api_version"=>"v2", "host_id"=>"2", "host_subscription"=>{"content_overrides_search"=>

      {"search"=>"label = satellite-client-6-for-rhel-8-x86_64-rpms", "enabled"=>true}

      , "content_overrides"=>[

      {"content_label"=>"satellite-client-6-for-rhel-8-x86_64-rpms", "value"=>"[FILTERED]", "name"=>"enabled"}

      ]}}

      Please make the --content-label optional (to lead users to use --search instead to limit the scope of the change), and/or apply the --content-label value into the search itself.

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

      How reproducible:
      100%

      Steps to Reproduce:
      1. See above reproducer steps

      Actual results:
      host subscription content-override --content-label <LABEL> applies the change unsocped, to any repo set

      Expected results:
      host subscription content-override --content-label <LABEL> should apply the change just to the label
      and/or
      host subscription content-override -search .. is allowed (-content-label is not mandatory)

      Additional info:

              Unassigned Unassigned
              rhn-support-pmoravec Pavel Moravec
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: