Sure! I took it on a testdrive, and found something unexpected:
# hammer host update --id <id> --content-view-environment-ids <input (just any string)>
Host updated.
# hammer host update --id 113 --content-view-environments <non-existent-names (test,test2 or test)>
Host updated.
# hammer host update --id 113 --content-view-environments <integer (1234)>
Could not update the host:
Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs.
This accepts every input and if there was no CV found with the text it just puts none. (or in the one case throws an error)
I also don’t see any errors in the log for the case where it just accepts, for the Internal Server Error:
2024-08-28T22:37:19 [I|app|7cc538b8] Started PUT "/api/hosts/113" for 10.0.0.251 at 2024-08-28 22:37:19 +0200
2024-08-28T22:37:19 [I|app|7cc538b8] Processing by Api::V2::HostsController#update as JSON
2024-08-28T22:37:19 [I|app|7cc538b8] Parameters: {"host"=>{"content_facet_attributes"=>{"content_view_environments"=>[1223]}, "subscription_facet_attributes"=>{}, "puppet_attributes"=>{}}, "apiv"=>"v2", "id"=>"113"}
2024-08-28T22:37:19 [I|app|7cc538b8] Authorized user foreman-admin(Admin User)
2024-08-28T22:37:19 [W|app|7cc538b8] Action failed
2024-08-28T22:37:19 [I|app|7cc538b8] Backtrace for 'Action failed' error (NoMethodError): undefined method `strip' for 1223:Integer
7cc538b8 | /usr/share/gems/gems/katello-4.14.0.rc1/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb:52:in `map'
7cc538b8 | /usr/share/gems/gems/katello-4.14.0.rc1/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb:52:in `set_content_view_environments'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:427:in `block in make_lambda'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:179:in `block (2 levels) in halting_and_conditional'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:180:in `block in halting_and_conditional'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:512:in `block in invoke_before'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:512:in `each'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:512:in `invoke_before'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:115:in `block in run_callbacks'
7cc538b8 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
7cc538b8 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
7cc538b8 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
7cc538b8 | /usr/share/gems/gems/audited-5.7.0/lib/audited/sweeper.rb:16:in `around'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
7cc538b8 | /usr/share/gems/gems/audited-5.7.0/lib/audited/sweeper.rb:16:in `around'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:137:in `run_callbacks'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb:41:in `process_action'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/rescue.rb:22:in `process_action'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb:203:in `block in instrument'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb:203:in `instrument'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
7cc538b8 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/base.rb:165:in `process'
7cc538b8 | /usr/share/gems/gems/actionview-6.1.7.8/lib/action_view/rendering.rb:39:in `process'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal.rb:190:in `dispatch'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal.rb:254:in `dispatch'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:33:in `serve'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/mapper.rb:49:in `serve'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:50:in `block in serve'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:32:in `each'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:32:in `serve'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:842:in `call'
7cc538b8 | /usr/share/gems/gems/katello-4.14.0.rc1/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
7cc538b8 | /usr/share/gems/gems/katello-4.14.0.rc1/lib/katello/middleware/event_daemon.rb:10:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/apipie-dsl-2.6.2/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
7cc538b8 | /usr/share/gems/gems/apipie-rails-1.4.2/lib/apipie/static_dispatcher.rb:74:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
7cc538b8 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
7cc538b8 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
7cc538b8 | /usr/share/gems/gems/apipie-rails-1.4.2/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
7cc538b8 | /usr/share/gems/gems/prometheus-client-4.2.3/lib/prometheus/middleware/exporter.rb:33:in `call'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/tempfile_reaper.rb:15:in `call'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/etag.rb:27:in `call'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/conditional_get.rb:40:in `call'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/head.rb:12:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
7cc538b8 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/session/abstract/id.rb:266:in `context'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/session/abstract/id.rb:260:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/cookies.rb:697:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:98:in `run_callbacks'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
7cc538b8 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/rack/logger.rb:37:in `call_app'
7cc538b8 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/rack/logger.rb:28:in `call'
7cc538b8 | /usr/share/gems/gems/sprockets-rails-3.5.2/lib/sprockets/rails/quiet_assets.rb:17:in `call'
7cc538b8 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/request_id.rb:26:in `call'
7cc538b8 | /usr/share/gems/gems/katello-4.14.0.rc1/lib/katello/prevent_json_parsing.rb:12:in `call'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/method_override.rb:24:in `call'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/runtime.rb:22:in `call'
7cc538b8 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/executor.rb:14:in `call'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/sendfile.rb:110:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/ssl.rb:77:in `call'
7cc538b8 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
7cc538b8 | /usr/share/gems/gems/secure_headers-6.7.0/lib/secure_headers/middleware.rb:11:in `call'
7cc538b8 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/engine.rb:539:in `call'
7cc538b8 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/railtie.rb:207:in `public_send'
7cc538b8 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/railtie.rb:207:in `method_missing'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/urlmap.rb:74:in `block in call'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/urlmap.rb:58:in `each'
7cc538b8 | /usr/share/gems/gems/rack-2.2.9/lib/rack/urlmap.rb:58:in `call'
7cc538b8 | /usr/share/gems/gems/puma-6.4.2/lib/puma/configuration.rb:272:in `call'
7cc538b8 | /usr/share/gems/gems/puma-6.4.2/lib/puma/request.rb:100:in `block in handle_request'
7cc538b8 | /usr/share/gems/gems/puma-6.4.2/lib/puma/thread_pool.rb:378:in `with_force_shutdown'
7cc538b8 | /usr/share/gems/gems/puma-6.4.2/lib/puma/request.rb:99:in `handle_request'
7cc538b8 | /usr/share/gems/gems/puma-6.4.2/lib/puma/server.rb:464:in `process_client'
7cc538b8 | /usr/share/gems/gems/puma-6.4.2/lib/puma/server.rb:245:in `block in run'
7cc538b8 | /usr/share/gems/gems/puma-6.4.2/lib/puma/thread_pool.rb:155:in `block in spawn_thread'
7cc538b8 | /usr/share/gems/gems/logging-2.4.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2024-08-28T22:37:19 [I|app|7cc538b8] Rendered api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout (Duration: 1.1ms | Allocations: 265)
2024-08-28T22:37:19 [I|app|7cc538b8] Rendered layout api/v2/layouts/error_layout.json.erb (Duration: 1.7ms | Allocations: 357)
2024-08-28T22:37:19 [I|app|7cc538b8] Completed 500 Internal Server Error in 129ms (Views: 2.4ms | ActiveRecord: 9.9ms | Allocations: 13015)
But yeah works pretty flawlessly from the hammer side!
If you try the same, non-existent CV set on the subscription-manager side it throws a No such environmnents: <input>
But with correct once it also works flawlessly there, tested with the subscription-manager from the Rocky Linux 9 repos, as well as Ubuntu 22.04 from the ATIX repo.
And you can also do such fun stuff