Problem:
When creating an external user-group, hammer throws an error. Although, I can successfully create the user-group and external user-group using the Web UI.
[root@acilformn001 ~]# hammer user-group external create \
> --name foreman-auditor \
> --auth-source acil389ds001 \
> --user-group foreman-auditor
Could not create external user group:
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.
Expected outcome:
Expecting hammer to create the external group.
Foreman and Proxy versions:
Foreman 3.4 with Katello 4.6
Foreman and Proxy plugin versions:
rubygem-foreman_puppet-4.0.1-1.fm3_4.el8.noarch
rubygem-hammer_cli_foreman_puppet-0.0.6-1.fm3_4.el8.noarch
foreman-debug-3.4.0-1.el8.noarch
rubygem-foreman-tasks-7.0.0-1.fm3_4.el8.noarch
foreman-installer-3.4.0-1.el8.noarch
foreman-selinux-3.4.0-1.el8.noarch
rubygem-hammer_cli_foreman_remote_execution-0.2.2-1.fm3_0.el8.noarch
foreman-3.4.0-1.el8.noarch
rubygem-foreman_maintain-1.1.3-1.el8.noarch
foreman-cli-3.4.0-1.el8.noarch
foreman-installer-katello-3.4.0-1.el8.noarch
rubygem-hammer_cli_foreman_tasks-0.0.17-1.fm3_2.el8.noarch
rubygem-foreman_openscap-5.2.2-2.fm3_3.el8.noarch
foreman-service-3.4.0-1.el8.noarch
rubygem-hammer_cli_foreman-3.4.0-1.el8.noarch
foreman-dynflow-sidekiq-3.4.0-1.el8.noarch
rubygem-foreman_remote_execution-8.0.0-2.fm3_4.el8.noarch
foreman-proxy-3.4.0-1.el8.noarch
foreman-release-3.4.0-1.el8.noarch
foreman-postgresql-3.4.0-1.el8.noarch
Distribution and version:
Red Hat Enterprise Linux release 8.6 (Ootpa)
4.18.0-372.26.1.el8_6.x86_64
Other relevant data:
Output from production.log:
2022-10-20T15:12:47 [I|app|a18dab71] Started GET "/apidoc/apipie_checksum" for 192.168.0.17 at 2022-10-20 15:12:47 +0000
2022-10-20T15:12:47 [I|app|a18dab71] Processing by Apipie::ApipiesController#apipie_checksum as JSON
2022-10-20T15:12:47 [I|app|a18dab71] Parameters: {"apipy"=>{}}
2022-10-20T15:12:47 [I|app|a18dab71] Rendered /usr/share/gems/gems/apipie-rails-0.5.20/app/views/apipie/apipies/apipie_checksum.json.erb (Duration: 5.2ms | Allocations: 5660)
2022-10-20T15:12:47 [I|app|a18dab71] Completed 200 OK in 6ms (Views: 6.0ms | ActiveRecord: 0.0ms | Allocations: 6096)
2022-10-20T15:12:47 [I|app|1c2487ce] Started GET "/apidoc/v2.en.json" for 192.168.0.17 at 2022-10-20 15:12:47 +0000
2022-10-20T15:12:47 [I|app|1c2487ce] Processing by Apipie::ApipiesController#index as JSON
2022-10-20T15:12:47 [I|app|1c2487ce] Parameters: {"version"=>"v2.en.json", "apipy"=>{}}
2022-10-20T15:12:50 [I|app|1c2487ce] Completed 200 OK in 3216ms (Views: 655.5ms | ActiveRecord: 0.0ms | Allocations: 2717715)
2022-10-20T15:12:51 [I|app|0950e784] Started GET "/api/locations?search=title+%3D+%22site1%22&per_page=1000&page=1" for 192.168.0.17 at 2022-10-20 15:12:51 +0000
2022-10-20T15:12:51 [I|app|0950e784] Processing by Api::V2::LocationsController#index as JSON
2022-10-20T15:12:51 [I|app|0950e784] Parameters: {"search"=>"title = \"site1\"", "per_page"=>"1000", "page"=>"1", "apiv"=>"v2", "location"=>{}}
2022-10-20T15:12:51 [I|app|0950e784] Authorized user admin(Admin User)
2022-10-20T15:12:52 [I|app|0950e784] Rendered api/v2/taxonomies/index.json.rabl within api/v2/layouts/index_layout (Duration: 4.8ms | Allocations: 1011)
2022-10-20T15:12:52 [I|app|0950e784] Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 11.3ms | Allocations: 6959)
2022-10-20T15:12:52 [I|app|0950e784] Completed 200 OK in 215ms (Views: 26.6ms | ActiveRecord: 14.8ms | Allocations: 16262)
2022-10-20T15:12:52 [I|app|ac6811d7] Started GET "/katello/api/organizations?search=title+%3D+%22Customer%22&per_page=1000&page=1" for 192.168.0.17 at 2022-10-20 15:12:52 +0000
2022-10-20T15:12:52 [I|app|ac6811d7] Processing by Katello::Api::V2::OrganizationsController#index as JSON
2022-10-20T15:12:52 [I|app|ac6811d7] Parameters: {"search"=>"title = \"Customer\"", "per_page"=>"1000", "page"=>"1", "api_version"=>"v2", "organization"=>{}}
2022-10-20T15:12:52 [I|app|ac6811d7] Authorized user admin(Admin User)
2022-10-20T15:12:52 [I|app|ac6811d7] Rendered /usr/share/gems/gems/katello-4.6.0.rc2/app/views/katello/api/v2/organizations/index.json.rabl within api/v2/layouts/index_layout (Duration: 3.1ms | Allocations: 641)
2022-10-20T15:12:52 [I|app|ac6811d7] Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 6.7ms | Allocations: 3403)
2022-10-20T15:12:52 [I|app|ac6811d7] Completed 200 OK in 224ms (Views: 38.7ms | ActiveRecord: 12.6ms | Allocations: 13057)
2022-10-20T15:12:52 [I|app|521566ab] Started GET "/api/usergroups?search=name+%3D+%22foreman-auditor%22&per_page=1000&page=1" for 192.168.0.17 at 2022-10-20 15:12:52 +0000
2022-10-20T15:12:52 [I|app|521566ab] Processing by Api::V2::UsergroupsController#index as JSON
2022-10-20T15:12:52 [I|app|521566ab] Parameters: {"search"=>"name = \"foreman-auditor\"", "per_page"=>"1000", "page"=>"1", "apiv"=>"v2", "usergroup"=>{}}
2022-10-20T15:12:52 [I|app|521566ab] Authorized user admin(Admin User)
2022-10-20T15:12:52 [I|app|521566ab] Rendered api/v2/usergroups/index.json.rabl within api/v2/layouts/index_layout (Duration: 7.1ms | Allocations: 6316)
2022-10-20T15:12:52 [I|app|521566ab] Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 14.8ms | Allocations: 12446)
2022-10-20T15:12:52 [I|app|521566ab] Completed 200 OK in 200ms (Views: 14.7ms | ActiveRecord: 13.1ms | Allocations: 20962)
2022-10-20T15:12:52 [I|app|e7483ad6] Started GET "/api/auth_sources?search=name+%3D+%22acil389ds001%22&per_page=1000&page=1" for 192.168.0.17 at 2022-10-20 15:12:52 +0000
2022-10-20T15:12:52 [I|app|e7483ad6] Processing by Api::V2::AuthSourcesController#index as JSON
2022-10-20T15:12:52 [I|app|e7483ad6] Parameters: {"search"=>"name = \"acil389ds001\"", "per_page"=>"1000", "page"=>"1", "apiv"=>"v2", "auth_source"=>{}}
2022-10-20T15:12:52 [I|app|e7483ad6] Authorized user admin(Admin User)
2022-10-20T15:12:52 [I|app|e7483ad6] Rendered api/v2/auth_sources/index.json.rabl within api/v2/layouts/index_layout (Duration: 13.4ms | Allocations: 8369)
2022-10-20T15:12:52 [I|app|e7483ad6] Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 21.5ms | Allocations: 14541)
2022-10-20T15:12:52 [I|app|e7483ad6] Completed 200 OK in 210ms (Views: 19.9ms | ActiveRecord: 15.6ms | Allocations: 23088)
2022-10-20T15:12:52 [I|app|121d3fbe] Started POST "/api/usergroups/4/external_usergroups" for 192.168.0.17 at 2022-10-20 15:12:52 +0000
2022-10-20T15:12:52 [I|app|121d3fbe] Processing by Api::V2::ExternalUsergroupsController#create as JSON
2022-10-20T15:12:52 [I|app|121d3fbe] Parameters: {"location_id"=>2, "organization_id"=>1, "external_usergroup"=>{"name"=>"external-foreman-auditor", "auth_source_id"=>5}, "apiv"=>"v2", "usergroup_id"=>"4"}
2022-10-20T15:12:52 [I|app|121d3fbe] Authorized user admin(Admin User)
2022-10-20T15:12:53 [W|app|121d3fbe] Action failed
2022-10-20T15:12:53 [I|app|121d3fbe] Backtrace for 'Action failed' error (NoMethodError): undefined method `external_usergroups' for #<Location:0x0000563354d64218>
121d3fbe | /usr/share/gems/gems/activemodel-6.1.6.1/lib/active_model/attribute_methods.rb:469:in `method_missing'
121d3fbe | /usr/share/foreman/app/controllers/api/v2/external_usergroups_controller.rb:39:in `create'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/abstract_controller/base.rb:228:in `process_action'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
121d3fbe | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
121d3fbe | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
121d3fbe | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
121d3fbe | /usr/share/gems/gems/audited-4.10.0/lib/audited/sweeper.rb:14:in `around'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
121d3fbe | /usr/share/gems/gems/audited-4.10.0/lib/audited/sweeper.rb:14:in `around'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:137:in `run_callbacks'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
121d3fbe | /usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/abstract_controller/base.rb:165:in `process'
121d3fbe | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/rendering.rb:39:in `process'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal.rb:190:in `dispatch'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal.rb:254:in `dispatch'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:33:in `serve'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:49:in `serve'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/journey/router.rb:50:in `block in serve'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/journey/router.rb:32:in `each'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/journey/router.rb:32:in `serve'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:842:in `call'
121d3fbe | /usr/share/gems/gems/katello-4.6.0.rc2/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
121d3fbe | /usr/share/gems/gems/katello-4.6.0.rc2/lib/katello/middleware/event_daemon.rb:10:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
121d3fbe | /usr/share/gems/gems/apipie-dsl-2.5.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
121d3fbe | /usr/share/gems/gems/apipie-rails-0.5.20/lib/apipie/static_dispatcher.rb:66:in `call'
121d3fbe | /usr/share/gems/gems/apipie-rails-0.5.20/lib/apipie/extractor/recorder.rb:137:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
121d3fbe | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
121d3fbe | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
121d3fbe | /usr/share/gems/gems/apipie-rails-0.5.20/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb:15:in `call'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/etag.rb:27:in `call'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/conditional_get.rb:40:in `call'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/head.rb:12:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
121d3fbe | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:266:in `context'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:260:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/cookies.rb:689:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
121d3fbe | /usr/share/gems/gems/railties-6.1.6.1/lib/rails/rack/logger.rb:37:in `call_app'
121d3fbe | /usr/share/gems/gems/railties-6.1.6.1/lib/rails/rack/logger.rb:28:in `call'
121d3fbe | /usr/share/gems/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
121d3fbe | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/request_id.rb:26:in `call'
121d3fbe | /usr/share/gems/gems/katello-4.6.0.rc2/lib/katello/prevent_json_parsing.rb:12:in `call'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/method_override.rb:24:in `call'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/runtime.rb:22:in `call'
121d3fbe | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/sendfile.rb:110:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/ssl.rb:77:in `call'
121d3fbe | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
121d3fbe | /usr/share/gems/gems/secure_headers-6.3.4/lib/secure_headers/middleware.rb:11:in `call'
121d3fbe | /usr/share/gems/gems/railties-6.1.6.1/lib/rails/engine.rb:539:in `call'
121d3fbe | /usr/share/gems/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `public_send'
121d3fbe | /usr/share/gems/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `method_missing'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:74:in `block in call'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `each'
121d3fbe | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `call'
121d3fbe | /usr/share/gems/gems/puma-5.6.4/lib/puma/configuration.rb:252:in `call'
121d3fbe | /usr/share/gems/gems/puma-5.6.4/lib/puma/request.rb:77:in `block in handle_request'
121d3fbe | /usr/share/gems/gems/puma-5.6.4/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
121d3fbe | /usr/share/gems/gems/puma-5.6.4/lib/puma/request.rb:76:in `handle_request'
121d3fbe | /usr/share/gems/gems/puma-5.6.4/lib/puma/server.rb:441:in `process_client'
121d3fbe | /usr/share/gems/gems/puma-5.6.4/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
121d3fbe | /usr/share/gems/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2022-10-20T15:12:53 [I|app|121d3fbe] Rendered api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout (Duration: 5.6ms | Allocations: 5750)
2022-10-20T15:12:53 [I|app|121d3fbe] Rendered layout api/v2/layouts/error_layout.json.erb (Duration: 10.8ms | Allocations: 11479)
2022-10-20T15:12:53 [I|app|121d3fbe] Completed 500 Internal Server Error in 262ms (Views: 12.5ms | ActiveRecord: 14.0ms | Allocations: 25097)
[root@acilformn001 ~]# hammer auth-source ldap list
---|--------------|--------------|------|-------
ID | NAME | SERVER | PORT | LDAPS?
---|--------------|--------------|------|-------
5 | acil389ds001 | acil389ds001 | 636 | yes
---|--------------|--------------|------|-------
[root@acilformn001 ~]# hammer user-group list
---|-----------------|------
ID | NAME | ADMIN
---|-----------------|------
5 | foreman-auditor | no
---|-----------------|------