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

MultiCV Content-view-environment can be added more than once for a host

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 6.18.0
    • Content Views
    • False
    • Proton Refinement Backlog
    • sat-proton
    • None
    • None
    • None
    • None

      Description of problem:

      When using multiple content views it is possible to add the same content-view-environment more than once

      How reproducible:

      • Satellite 6.17.x
      • Satellite 6.18.x

      Is this issue a regression from an earlier version:

      No, MultiCV feature not yet GA

      Steps to Reproduce:
      1. Enable multiple content views in settings

      # hammer settings set --name allow_multiple_content_views --value true

       

      2. Add the same content-view-environment twice

          # hammer host update --id fluffy.example.com --content-view-environments "prd/cv-os-rhel-10-x86_64,prd/cv-epel-rhel-10-x86_64,prd/cv-os-rhel-10-x86_64"

       

      Actual behavior:
      The hammer output shows an error 500 but still assigns duplicate CVs:

       

      [root@satellite6:/root]# hammer host update --id fluffy.example.com --content-view-environments "prd/cv-os-rhel-10-x86_64,prd/cv-epel-rhel-10-x86_64,prd/cv-os-rhel-10-x86_64"
      Could not update the host:
        500 Internal Server Error
      

       

      [root@satellite6:/root]# hammer host list --search=fluffy.example.com --fields="name,Content view environments"
      -------------------|----------------------------------------------------------------------------
      NAME                | CONTENT VIEW ENVIRONMENTS
      -------------------|----------------------------------------------------------------------------
      fluffy.example.com | prd/cv-os-rhel-10-x86_64,prd/cv-epel-rhel-10-x86_64,prd/cv-os-rhel-10-x86_64
      -------------------|----------------------------------------------------------------------------
      

       

      Looking at the client side the  content-view-environment is only shown once:

      [root@fluffy:/root]# subscription-manager environments --list-enabled
      -------------------------------------------
                Environments
      -------------------------------------------
      Name:        prd/cv-os-rhel-10-x86_64
      Description:
       
      Name:        prd/cv-epel-rhel-10-x86_64
      Description:

       

      Expected behavior:
      Hammer should not add the same content-view-environment more than one time.

       

      Business Impact / Additional info:

      No business impact.

       

      From production log:

      2026-01-29T13:51:40 [I|app|e032a193] Started PUT "/api/hosts/fluffy.example.com" for 192.168.4.25 at 2026-01-29 13:51:40 +0100
      2026-01-29T13:51:40 [I|app|e032a193] Processing by Api::V2::HostsController#update as JSON
      2026-01-29T13:51:40 [I|app|e032a193]   Parameters: {"location_id"=>2, "organization_id"=>1, "host"=>{"content_facet_attributes"=>

      {"content_view_environments"=>["prd/cv-os-rhel-10-x86_64", "prd/cv-epel-rhel-10-x86_64", "prd/cv-os-rhel-10-x86_64"]}

      , "subscription_facet_attributes"=>{}, "puppet_attributes"=>{}}, "apiv"=>"v2", "id"=>"fluffy.example.com"}
      2026-01-29T13:51:40 [I|app|e032a193] Authorized user admin(Admin User)
      2026-01-29T13:51:40 [E|app|e032a193] exception when talking to a remote client: Katello::Resources::Candlepin::Consumer: 409 Conflict {"displayMessage":"Environment \"3d6f18ae47fa2d4e0150fdfee07630cb\" specified more than once.","requestUuid":"1f417b74-9d0e-4c0a-a237-8d1c0d87408c"} (PUT /candlepin/consumers/d4e3912e-0e09-403f-9ecb-b95c5ee8cec8) RestClient::Conflict: Katello::Resources::Candlepin::Consumer: 409 Conflict {"displayMessage":"Environment \"3d6f18ae47fa2d4e0150fdfee07630cb\" specified more than once.","requestUuid":"1f417b74-9d0e-4c0a-a237-8d1c0d87408c"} (PUT /candlepin/consumers/d4e3912e-0e09-403f-9ecb-b95c5ee8cec8)
       e032a193 | Body: {"displayMessage":"Environment \"3d6f18ae47fa2d4e0150fdfee07630cb\" specified more than once.","requestUuid":"1f417b74-9d0e-4c0a-a237-8d1c0d87408c"}
       e032a193 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/abstract_response.rb:249:in `exception_with_response'
       e032a193 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/abstract_response.rb:129:in `return!'
       e032a193 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:836:in `process_result'
       e032a193 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:743:in `block in transmit'
       e032a193 | /usr/share/ruby/net/http.rb:960:in `start'
       e032a193 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:727:in `transmit'
       e032a193 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:163:in `execute'
       e032a193 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:63:in `execute'
       e032a193 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/resource.rb:79:in `put'
       e032a193 | /usr/share/gems/gems/katello-4.18.0.5/app/lib/katello/http_resource.rb:98:in `issue_request'
       e032a193 | /usr/share/gems/gems/katello-4.18.0.5/app/lib/katello/http_resource.rb:49:in `block (2 levels) in singleton class'
       e032a193 | /usr/share/gems/gems/katello-4.18.0.5/app/lib/katello/resources/candlepin/consumer.rb:76:in `update'
       e032a193 | /usr/share/gems/gems/katello-4.18.0.5/app/models/katello/concerns/subscription_facet_host_extensions.rb:60:in `update_candlepin_associations'
       e032a193 | /usr/share/gems/gems/katello-4.18.0.5/app/models/katello/host/content_facet.rb:152:in `content_view_environments='
       e032a193 | /usr/share/gems/gems/katello-4.18.0.5/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb:77:in `set_content_view_environments'
       e032a193 | /usr/share/gems/gems/katello-4.18.0.5/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb:48:in `handle_content_view_environments_for_update'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:400:in `block in make_lambda'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:180:in `block (2 levels) in halting_and_conditional'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:181:in `block in halting_and_conditional'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:595:in `block in invoke_before'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:595:in `each'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:595:in `invoke_before'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:116:in `block in run_callbacks'
       e032a193 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
       e032a193 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
       e032a193 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
       e032a193 | /usr/share/gems/gems/audited-5.8.0/lib/audited/sweeper.rb:16:in `around'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
       e032a193 | /usr/share/gems/gems/audited-5.8.0/lib/audited/sweeper.rb:16:in `around'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:138:in `run_callbacks'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/callbacks.rb:233:in `process_action'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/rescue.rb:23:in `process_action'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/notifications.rb:206:in `block in instrument'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/notifications.rb:206:in `instrument'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/instrumentation.rb:66:in `process_action'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
       e032a193 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/base.rb:151:in `process'
       e032a193 | /usr/share/gems/gems/actionview-7.0.8.7/lib/action_view/rendering.rb:39:in `process'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal.rb:188:in `dispatch'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal.rb:251:in `dispatch'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/route_set.rb:32:in `serve'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/mapper.rb:48:in `serve'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:50:in `block in serve'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:32:in `each'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:32:in `serve'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/route_set.rb:852:in `call'
       e032a193 | /usr/share/gems/gems/katello-4.18.0.5/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
       e032a193 | /usr/share/gems/gems/katello-4.18.0.5/lib/katello/middleware/event_daemon.rb:10:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/apipie-dsl-2.6.2/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
       e032a193 | /usr/share/gems/gems/apipie-rails-1.4.2/lib/apipie/static_dispatcher.rb:74:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call'
       e032a193 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
       e032a193 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
       e032a193 | /usr/share/gems/gems/apipie-rails-1.4.2/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
       e032a193 | /usr/share/gems/gems/prometheus-client-4.2.5/lib/prometheus/middleware/exporter.rb:33:in `call'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb:15:in `call'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/etag.rb:27:in `call'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/conditional_get.rb:40:in `call'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/head.rb:12:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/http/content_security_policy.rb:39:in `call'
       e032a193 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:266:in `context'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:260:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/cookies.rb:704:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:99:in `run_callbacks'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
       e032a193 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/rack/logger.rb:40:in `call_app'
       e032a193 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/rack/logger.rb:27:in `call'
       e032a193 | /usr/share/gems/gems/sprockets-rails-3.5.2/lib/sprockets/rails/quiet_assets.rb:17:in `call'
       e032a193 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/request_id.rb:26:in `call'
       e032a193 | /usr/share/gems/gems/katello-4.18.0.5/lib/katello/prevent_json_parsing.rb:12:in `call'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/method_override.rb:24:in `call'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/runtime.rb:22:in `call'
       e032a193 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/executor.rb:14:in `call'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/sendfile.rb:110:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/ssl.rb:77:in `call'
       e032a193 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
       e032a193 | /usr/share/gems/gems/secure_headers-7.1.0/lib/secure_headers/middleware.rb:11:in `call'
       e032a193 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/engine.rb:530:in `call'
       e032a193 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/railtie.rb:226:in `public_send'
       e032a193 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/railtie.rb:226:in `method_missing'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:74:in `block in call'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `each'
       e032a193 | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `call'
       e032a193 | /usr/share/gems/gems/puma-6.6.1/lib/puma/configuration.rb:279:in `call'
       e032a193 | /usr/share/gems/gems/puma-6.6.1/lib/puma/request.rb:99:in `block in handle_request'
       e032a193 | /usr/share/gems/gems/puma-6.6.1/lib/puma/thread_pool.rb:390:in `with_force_shutdown'
       e032a193 | /usr/share/gems/gems/puma-6.6.1/lib/puma/request.rb:98:in `handle_request'
       e032a193 | /usr/share/gems/gems/puma-6.6.1/lib/puma/server.rb:472:in `process_client'
       e032a193 | /usr/share/gems/gems/puma-6.6.1/lib/puma/server.rb:254:in `block in run'
       e032a193 | /usr/share/gems/gems/puma-6.6.1/lib/puma/thread_pool.rb:167:in `block in spawn_thread'
       e032a193 | /usr/share/gems/gems/logging-2.4.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
      2026-01-29T13:51:40 [I|app|e032a193] Completed 500 Internal Server Error in 247ms (ActiveRecord: 12.9ms | Allocations: 60260)
      2026-01-29T13:51:40 [F|app|e032a193]
       e032a193 | NoMethodError (undefined method `request_from_katello_cli?' for #<Api::V2::HostsController:0x0000000022bd20>):
       e032a193 |
       e032a193 | katello (4.18.0.5) app/lib/katello/api/v2/error_handling.rb:60:in `rescue_from_exception_with_response'
       e032a193 | katello (4.18.0.5) lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
       e032a193 | katello (4.18.0.5) lib/katello/middleware/event_daemon.rb:10:in `call'
       e032a193 | lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
       e032a193 | lib/foreman/middleware/telemetry.rb:10:in `call'
       e032a193 | lib/foreman/middleware/logging_context_session.rb:22:in `call'
       e032a193 | lib/foreman/middleware/logging_context_request.rb:11:in `call'
       e032a193 | katello (4.18.0.5) lib/katello/prevent_json_parsing.rb:12:in `call'

       

       

              Unassigned Unassigned
              rhn-support-smeyer Stefan Meyer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: