Bug 2210309
| Summary: | Using a non-admin user to create an override value for a specific Ansible variable via Satellite API fails | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | momran |
| Component: | Ansible - Configuration Management | Assignee: | satellite6-bugs <satellite6-bugs> |
| Status: | CLOSED DUPLICATE | QA Contact: | Satellite QE Team <sat-qe-bz-list> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.11.4 | CC: | nalfassi, pmoravec |
| Target Milestone: | Unspecified | ||
| Target Release: | Unused | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-05-28 15:34:14 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
momran
2023-05-26 14:24:59 UTC
Error backtrace:
~~~
# grep 1ea14cc1 /var/log/foreman/production.log
2023-05-26T11:08:05 [I|app|1ea14cc1] Started POST "/ansible/api/ansible_override_values" for 10.37.195.118 at 2023-05-26 11:08:05 +0200
2023-05-26T11:08:05 [I|app|1ea14cc1] Katello event daemon started process=204671
2023-05-26T11:08:06 [I|app|1ea14cc1] Subscribed to katello.candlepin.candlepin_events
2023-05-26T11:08:06 [D|sql|1ea14cc1] User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."lower_login" = $1 LIMIT $2 [["lower_login", "foreman_admin"], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] AuthSource Load (0.2ms) SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|per|1ea14cc1] Current user set to foreman_admin (admin)
2023-05-26T11:08:06 [D|sql|1ea14cc1] Organization Load (0.3ms) SELECT "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."type" = $1 AND "taxonomies"."created_in_katello" != $2 ORDER BY "taxonomies"."title" ASC [["type", "Organization"], ["created_in_katello", true]]
2023-05-26T11:08:06 [I|app|1ea14cc1] Processing by Api::V2::AnsibleOverrideValuesController#create as */*
2023-05-26T11:08:06 [I|app|1ea14cc1] Parameters: {"ansible_variable_id"=>"1", "override_value"=>"[FILTERED]", "apiv"=>"v2", "ansible_override_value"=>{"ansible_variable_id"=>"1", "override_value"=>"[FILTERED]"}}
2023-05-26T11:08:06 [D|sql|1ea14cc1] (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2023-05-26T11:08:06 [D|sql|1ea14cc1] Setting Load (0.8ms) SELECT "settings".* FROM "settings" WHERE "settings"."category" IN ($1, $2, $3, $4, $5, $6, $7) AND "settings"."value" IS NOT NULL AND (updated_at >= '2023-05-26 09:06:06.244148') [["category", "Setting::ForemanTasks"], ["category", "Setting::Bootdisk"], ["category", "Setting::Discovered"], ["category", "Setting::TemplateSync"], ["category", "Setting::RhCloud"], ["category", "Setting::Content"], ["category", "Setting"]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."lower_login" = $1 LIMIT $2 [["lower_login", "user_03508223"], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] PersonalAccessToken Load (0.8ms) SELECT "personal_access_tokens".* FROM "personal_access_tokens" WHERE "personal_access_tokens"."revoked" = $1 AND (expires_at >= '2023-05-26 09:08:06.214124' OR expires_at IS NULL) AND "personal_access_tokens"."user_id" = $2 AND "personal_access_tokens"."token" = $3 LIMIT $4 [["revoked", false], ["user_id", 7], ["token", "$pbkdf2sha1$50000$902ba3cda1883801594b6e1b452790cc53948fda$GRFyCVq8IW5NhkVrefi+2zzcgellyq/T1bqM9WA9hvP51q+XW6G2"], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] PersonalAccessToken Load (0.4ms) SELECT "personal_access_tokens".* FROM "personal_access_tokens" WHERE "personal_access_tokens"."revoked" = $1 AND (expires_at >= '2023-05-26 09:08:06.245773' OR expires_at IS NULL) AND "personal_access_tokens"."user_id" = $2 AND "personal_access_tokens"."token" = $3 LIMIT $4 [["revoked", false], ["user_id", 7], ["token", "$2a$09$902ba3cda1883801594b6ePG1FtjM6D.ZltopgOCrl0QtwNuUEala"], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] PersonalAccessToken Load (0.2ms) SELECT "personal_access_tokens".* FROM "personal_access_tokens" WHERE "personal_access_tokens"."revoked" = $1 AND (expires_at >= '2023-05-26 09:08:06.277588' OR expires_at IS NULL) AND "personal_access_tokens"."user_id" = $2 AND "personal_access_tokens"."token" = $3 LIMIT $4 [["revoked", false], ["user_id", 7], ["token", "2c5096e78cd93748484e64fd5d7f566f30d831c3"], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] AuthSource Load (0.2ms) SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."lower_login" = $1 LIMIT $2 [["lower_login", "user_03508223"], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|app|1ea14cc1] Authenticated user user_03508223 against INTERNAL authentication source
2023-05-26T11:08:06 [D|sql|1ea14cc1] CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."lower_login" = $1 LIMIT $2 [["lower_login", "foreman_admin"], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] CACHE AuthSource Load (0.0ms) SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|per|1ea14cc1] Current user set to foreman_admin (admin)
2023-05-26T11:08:06 [D|app|1ea14cc1] Post-login processing for user_03508223
2023-05-26T11:08:06 [D|sql|1ea14cc1] Katello::Event Update All (1.0ms) UPDATE "katello_events" SET "in_progress" = $1 WHERE "katello_events"."in_progress" = $2 [["in_progress", false], ["in_progress", true]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."lower_login" = $1 LIMIT $2 [["lower_login", "foreman_admin"], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] CACHE AuthSource Load (0.0ms) SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|per|1ea14cc1] Current user set to foreman_admin (admin)
2023-05-26T11:08:06 [I|kat|1ea14cc1] Polling Katello Event Queue
2023-05-26T11:08:06 [D|sql|1ea14cc1] User Update (1.9ms) UPDATE "users" SET "last_login_on" = $1 WHERE "users"."id" = $2 [["last_login_on", "2023-05-26 09:08:06.315002"], ["id", 7]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] Role Load (0.4ms) SELECT "roles".* FROM "roles" WHERE "roles"."builtin" = $1 LIMIT $2 [["builtin", 2], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] Role Exists? (2.5ms) SELECT 1 AS one FROM "roles" INNER JOIN "user_roles" ON "roles"."id" = "user_roles"."role_id" WHERE "user_roles"."owner_id" = $1 AND "user_roles"."owner_type" = $2 AND "roles"."id" = $3 LIMIT $4 [["owner_id", 7], ["owner_type", "User"], ["id", 1], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] Katello::Event Load (1.3ms) SELECT "katello_events".* FROM "katello_events" WHERE ("katello_events"."process_after" IS NULL OR "katello_events"."process_after" BETWEEN $1 AND $2) AND "katello_events"."in_progress" = $3 ORDER BY "katello_events"."created_at" ASC LIMIT $4 [["process_after", "4713-01-01 BC"], ["process_after", "2023-05-26 09:08:06.315888"], ["in_progress", false], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] Usergroup Load (1.5ms) SELECT "usergroups".* FROM "usergroups" INNER JOIN "cached_usergroup_members" ON "usergroups"."id" = "cached_usergroup_members"."usergroup_id" WHERE "cached_usergroup_members"."user_id" = $1 ORDER BY usergroups.name [["user_id", 7]]
2023-05-26T11:08:06 [I|per|1ea14cc1] Current user set to user_03508223 (regular)
2023-05-26T11:08:06 [D|sql|1ea14cc1] (0.2ms) SELECT auth_sources.id FROM "auth_sources" WHERE "auth_sources"."type" IN ($1, $2) [["type", "AuthSourceHidden"], ["type", "ForemanVirtWhoConfigure::AuthSourceHiddenWithAuthentication"]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."auth_source_id" NOT IN (2) AND "users"."lower_login" = $1 LIMIT $2 [["lower_login", "user_03508223"], ["LIMIT", 1]]
2023-05-26T11:08:06 [I|app|1ea14cc1] Authorized user user_03508223(user_03508223)
2023-05-26T11:08:06 [D|app|1ea14cc1] Post-login processing for user_03508223
2023-05-26T11:08:06 [D|sql|1ea14cc1] User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."lower_login" = $1 LIMIT $2 [["lower_login", "foreman_admin"], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] AuthSource Load (0.2ms) SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|per|1ea14cc1] Current user set to foreman_admin (admin)
2023-05-26T11:08:06 [D|sql|1ea14cc1] User Update (0.3ms) UPDATE "users" SET "last_login_on" = $1 WHERE "users"."id" = $2 [["last_login_on", "2023-05-26 09:08:06.335525"], ["id", 7]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] Role Load (0.1ms) SELECT "roles".* FROM "roles" WHERE "roles"."builtin" = $1 LIMIT $2 [["builtin", 2], ["LIMIT", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] Role Exists? (0.2ms) SELECT 1 AS one FROM "roles" INNER JOIN "user_roles" ON "roles"."id" = "user_roles"."role_id" WHERE "user_roles"."owner_id" = $1 AND "user_roles"."owner_type" = $2 AND "roles"."id" = $3 LIMIT $4 [["owner_id", 7], ["owner_type", "User"], ["id", 1], ["LIMIT", 1]]
2023-05-26T11:08:06 [I|per|1ea14cc1] Current user set to user_03508223 (regular)
2023-05-26T11:08:06 [D|sql|1ea14cc1] Usergroup Load (0.3ms) SELECT "usergroups".* FROM "usergroups" INNER JOIN "cached_usergroup_members" ON "usergroups"."id" = "cached_usergroup_members"."usergroup_id" WHERE "cached_usergroup_members"."user_id" = $1 ORDER BY usergroups.name [["user_id", 7]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] AuthSource Load (0.1ms) SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2023-05-26T11:08:06 [I|per|1ea14cc1] Current user set to user_03508223 (regular)
2023-05-26T11:08:06 [I|per|1ea14cc1] Current user set to user_03508223 (regular)
2023-05-26T11:08:06 [D|sql|1ea14cc1] Location Load (0.1ms) SELECT "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."type" = $1 [["type", "Location"]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] Taxonomy Load (0.4ms) SELECT "taxonomies".* FROM "taxonomies" INNER JOIN "taxable_taxonomies" ON "taxonomies"."id" = "taxable_taxonomies"."taxonomy_id" WHERE "taxable_taxonomies"."taxable_id" = $1 AND "taxable_taxonomies"."taxable_type" = $2 AND "taxonomies"."type" = $3 ORDER BY "taxonomies"."title" ASC [["taxable_id", 7], ["taxable_type", "User"], ["type", "Location"]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] (0.2ms) SELECT "taxonomies"."id" FROM "taxonomies" WHERE (("taxonomies"."ancestry" LIKE '2/%' OR "taxonomies"."ancestry" = '2') OR "taxonomies"."id" = 2) ORDER BY "taxonomies"."title" ASC
2023-05-26T11:08:06 [D|tax|1ea14cc1] Current location set to none
2023-05-26T11:08:06 [D|sql|1ea14cc1] Organization Load (0.1ms) SELECT "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."type" = $1 [["type", "Organization"]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] Taxonomy Load (0.2ms) SELECT "taxonomies".* FROM "taxonomies" INNER JOIN "taxable_taxonomies" ON "taxonomies"."id" = "taxable_taxonomies"."taxonomy_id" WHERE "taxable_taxonomies"."taxable_id" = $1 AND "taxable_taxonomies"."taxable_type" = $2 AND "taxonomies"."type" = $3 ORDER BY "taxonomies"."title" ASC [["taxable_id", 7], ["taxable_type", "User"], ["type", "Organization"]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] (0.2ms) SELECT "taxonomies"."id" FROM "taxonomies" WHERE (("taxonomies"."ancestry" LIKE '1/%' OR "taxonomies"."ancestry" = '1') OR "taxonomies"."id" = 1) ORDER BY "taxonomies"."title" ASC
2023-05-26T11:08:06 [D|sql|1ea14cc1] (0.1ms) SELECT "taxonomies"."id" FROM "taxonomies" WHERE (("taxonomies"."ancestry" LIKE '5/%' OR "taxonomies"."ancestry" = '5') OR "taxonomies"."id" = 5) ORDER BY "taxonomies"."title" ASC
2023-05-26T11:08:06 [D|tax|1ea14cc1] Current organization set to none
2023-05-26T11:08:06 [D|sql|1ea14cc1] Role Load (1.2ms) SELECT DISTINCT "roles".* FROM "roles" INNER JOIN "cached_user_roles" ON "roles"."id" = "cached_user_roles"."role_id" WHERE "cached_user_roles"."user_id" = $1 [["user_id", 7]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] (0.9ms) SELECT permissions.name FROM "permissions" INNER JOIN "filterings" ON "permissions"."id" = "filterings"."permission_id" INNER JOIN "filters" ON "filterings"."filter_id" = "filters"."id" WHERE "filters"."role_id" = $1 ORDER BY filters.role_id, filters.id [["role_id", 1]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] (0.4ms) SELECT permissions.name FROM "permissions" INNER JOIN "filterings" ON "permissions"."id" = "filterings"."permission_id" INNER JOIN "filters" ON "filterings"."filter_id" = "filters"."id" WHERE "filters"."role_id" = $1 ORDER BY filters.role_id, filters.id [["role_id", 34]]
2023-05-26T11:08:06 [D|tax|1ea14cc1] Current location set to none
2023-05-26T11:08:06 [D|tax|1ea14cc1] Current organization set to none
2023-05-26T11:08:06 [D|per|1ea14cc1] checking permission edit_external_variables for class AnsibleVariable
2023-05-26T11:08:06 [D|per|1ea14cc1] organization_ids: []
2023-05-26T11:08:06 [D|per|1ea14cc1] location_ids: []
2023-05-26T11:08:06 [D|sql|1ea14cc1] Filter Load (1.8ms) SELECT DISTINCT "filters".* FROM "filters" INNER JOIN "roles" ON "filters"."role_id" = "roles"."id" INNER JOIN "cached_user_roles" ON "roles"."id" = "cached_user_roles"."role_id" INNER JOIN "filterings" ON "filterings"."filter_id" = "filters"."id" INNER JOIN "permissions" ON "permissions"."id" = "filterings"."permission_id" LEFT JOIN taxable_taxonomies ON (filters.id = taxable_taxonomies.taxable_id AND taxable_type = 'Filter') LEFT JOIN taxonomies ON (taxonomies.id = taxable_taxonomies.taxonomy_id) WHERE "cached_user_roles"."user_id" = $1 AND "permissions"."resource_type" = $2 AND "permissions"."name" = $3 AND (taxable_taxonomies.id IS NULL OR (taxonomies.type = 'Organization') OR (taxonomies.type = 'Location')) [["user_id", 7], ["resource_type", "AnsibleVariable"], ["name", "edit_external_variables"]]
2023-05-26T11:08:06 [D|per|1ea14cc1]
2023-05-26T11:08:06 [D|per|1ea14cc1] no filters found for given permission
2023-05-26T11:08:06 [D|sql|1ea14cc1] AnsibleVariable Load (0.5ms) SELECT "lookup_keys".* FROM "lookup_keys" WHERE "lookup_keys"."type" = $1 AND (1=0) AND "lookup_keys"."id" = $2 ORDER BY lookup_keys.key LIMIT $3 [["type", "AnsibleVariable"], ["id", 1], ["LIMIT", 1]]
2023-05-26T11:08:06 [W|app|1ea14cc1] Action failed
2023-05-26T11:08:06 [I|app|1ea14cc1] Backtrace for 'Action failed' error (NoMethodError): undefined method `lookup_values' for nil:NilClass
1ea14cc1 | /usr/share/gems/gems/foreman_ansible-7.0.4.1/app/controllers/api/v2/ansible_override_values_controller.rb:29:in `create'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/abstract_controller/base.rb:195:in `process_action'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_controller/metal/rendering.rb:30:in `process_action'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
1ea14cc1 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
1ea14cc1 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
1ea14cc1 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
1ea14cc1 | /usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
1ea14cc1 | /usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/callbacks.rb:139:in `run_callbacks'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/abstract_controller/callbacks.rb:41:in `process_action'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_controller/metal/rescue.rb:22:in `process_action'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/notifications.rb:180:in `block in instrument'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/notifications.rb:180:in `instrument'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
1ea14cc1 | /usr/share/gems/gems/activerecord-6.0.6/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/abstract_controller/base.rb:136:in `process'
1ea14cc1 | /usr/share/gems/gems/actionview-6.0.6/lib/action_view/rendering.rb:39:in `process'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_controller/metal.rb:190:in `dispatch'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_controller/metal.rb:254:in `dispatch'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/routing/route_set.rb:33:in `serve'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/routing/mapper.rb:48:in `serve'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/journey/router.rb:49:in `block in serve'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/journey/router.rb:32:in `each'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/journey/router.rb:32:in `serve'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/routing/route_set.rb:834:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/katello-4.3.0.52/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
1ea14cc1 | /usr/share/gems/gems/katello-4.3.0.52/lib/katello/middleware/event_daemon.rb:10:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/apipie-dsl-2.4.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
1ea14cc1 | /usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/static_dispatcher.rb:66:in `call'
1ea14cc1 | /usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/extractor/recorder.rb:137:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
1ea14cc1 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
1ea14cc1 | /usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/tempfile_reaper.rb:15:in `call'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/etag.rb:27:in `call'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/conditional_get.rb:40:in `call'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/head.rb:12:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
1ea14cc1 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/session/abstract/id.rb:266:in `context'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/session/abstract/id.rb:260:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/cookies.rb:654:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/callbacks.rb:101:in `run_callbacks'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
1ea14cc1 | /usr/share/gems/gems/railties-6.0.6/lib/rails/rack/logger.rb:37:in `call_app'
1ea14cc1 | /usr/share/gems/gems/railties-6.0.6/lib/rails/rack/logger.rb:28:in `call'
1ea14cc1 | /usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
1ea14cc1 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/request_id.rb:27:in `call'
1ea14cc1 | /usr/share/gems/gems/katello-4.3.0.52/lib/katello/prevent_json_parsing.rb:12:in `call'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/method_override.rb:24:in `call'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/runtime.rb:22:in `call'
1ea14cc1 | /usr/share/gems/gems/activesupport-6.0.6/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/executor.rb:14:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/static.rb:126:in `call'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/sendfile.rb:110:in `call'
1ea14cc1 | /usr/share/gems/gems/actionpack-6.0.6/lib/action_dispatch/middleware/host_authorization.rb:97:in `call'
1ea14cc1 | /usr/share/gems/gems/secure_headers-6.3.0/lib/secure_headers/middleware.rb:11:in `call'
1ea14cc1 | /usr/share/gems/gems/railties-6.0.6/lib/rails/engine.rb:527:in `call'
1ea14cc1 | /usr/share/gems/gems/railties-6.0.6/lib/rails/railtie.rb:190:in `public_send'
1ea14cc1 | /usr/share/gems/gems/railties-6.0.6/lib/rails/railtie.rb:190:in `method_missing'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/urlmap.rb:74:in `block in call'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/urlmap.rb:58:in `each'
1ea14cc1 | /usr/share/gems/gems/rack-2.2.3.1/lib/rack/urlmap.rb:58:in `call'
1ea14cc1 | /usr/share/gems/gems/puma-5.6.2/lib/puma/configuration.rb:252:in `call'
1ea14cc1 | /usr/share/gems/gems/puma-5.6.2/lib/puma/request.rb:77:in `block in handle_request'
1ea14cc1 | /usr/share/gems/gems/puma-5.6.2/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
1ea14cc1 | /usr/share/gems/gems/puma-5.6.2/lib/puma/request.rb:76:in `handle_request'
1ea14cc1 | /usr/share/gems/gems/puma-5.6.2/lib/puma/server.rb:441:in `process_client'
1ea14cc1 | /usr/share/gems/gems/puma-5.6.2/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
1ea14cc1 | /usr/share/gems/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2023-05-26T11:08:06 [I|app|1ea14cc1] Rendering api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout
2023-05-26T11:08:06 [I|app|1ea14cc1] Rendered api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout (Duration: 0.8ms | Allocations: 370)
2023-05-26T11:08:06 [I|app|1ea14cc1] Completed 500 Internal Server Error in 204ms (Views: 4.8ms | ActiveRecord: 31.2ms | Allocations: 65118)
2023-05-26T11:08:06 [D|sql|1ea14cc1] (0.1ms) BEGIN
2023-05-26T11:08:06 [D|sql|1ea14cc1] ActiveRecord::SessionStore::Session Update (0.2ms) UPDATE "sessions" SET "data" = $1, "updated_at" = $2 WHERE "sessions"."id" = $3 [["data", "BAh7CUkiCXVzZXIGOgZFRmkMSSIeYXBpX2F1dGhlbnRpY2F0ZWRfc2Vzc2lv\nbgY7AEZUSSIPZXhwaXJlc19hdAY7AEZsKwcGhXBkSSILbG9jYWxlBjsARkki\nB2VuBjsARg==\n"], ["updated_at", "2023-05-26 09:08:06.397188"], ["id", 8436]]
2023-05-26T11:08:06 [D|sql|1ea14cc1] (0.3ms) COMMIT
2023-05-26T11:08:09 [D|sql|1ea14cc1] Katello::Event Load (0.3ms) SELECT "katello_events".* FROM "katello_events" WHERE ("katello_events"."process_after" IS NULL OR "katello_events"."process_after" BETWEEN $1 AND $2) AND "katello_events"."in_progress" = $3 ORDER BY "katello_events"."created_at" ASC LIMIT $4 [["process_after", "4713-01-01 BC"], ["process_after", "2023-05-26 09:08:09.331934"], ["in_progress", false], ["LIMIT", 1]]
2023-05-26T11:08:12 [D|sql|1ea14cc1] Katello::Event Load (0.3ms) SELECT "katello_events".* FROM "katello_events" WHERE ("katello_events"."process_after" IS NULL OR "katello_events"."process_after" BETWEEN $1 AND $2) AND "katello_events"."in_progress" = $3 ORDER BY "katello_events"."created_at" ASC LIMIT $4 [["process_after", "4713-01-01 BC"], ["process_after", "2023-05-26 09:08:12.335909"], ["in_progress", false], ["LIMIT", 1]]
2023-05-26T11:08:15 [D|sql|1ea14cc1] Katello::Event Load (0.4ms) SELECT "katello_events".* FROM "katello_events" WHERE ("katello_events"."process_after" IS NULL OR "katello_events"."process_after" BETWEEN $1 AND $2) AND "katello_events"."in_progress" = $3 ORDER BY "katello_events"."created_at" ASC LIMIT $4 [["process_after", "4713-01-01 BC"], ["process_after", "2023-05-26 09:08:15.338348"], ["in_progress", false], ["LIMIT", 1]]
2023-05-26T11:08:18 [D|sql|1ea14cc1] Katello::Event Load (0.4ms) SELECT "katello_events".* FROM "katello_events" WHERE ("katello_events"."process_after" IS NULL OR "katello_events"."process_after" BETWEEN $1 AND $2) AND "katello_events"."in_progress" = $3 ORDER BY "katello_events"."created_at" ASC LIMIT $4 [["process_after", "4713-01-01 BC"], ["process_after", "2023-05-26 09:08:18.341182"], ["in_progress", false], ["LIMIT", 1]]
2023-05-26T11:08:21 [D|sql|1ea14cc1] Katello::Event Load (0.4ms) SELECT "katello_events".* FROM "katello_events" WHERE ("katello_events"."process_after" IS NULL OR "katello_events"."process_after" BETWEEN $1 AND $2) AND "katello_events"."in_progress" = $3 ORDER BY "katello_events"."created_at" ASC LIMIT $4 [["process_after", "4713-01-01 BC"], ["process_after", "2023-05-26 09:08:21.344706"], ["in_progress", false], ["LIMIT", 1]]
2023-05-26T11:08:24 [D|sql|1ea14cc1] Katello::Event Load (0.3ms) SELECT "katello_events".* FROM "katello_events" WHERE ("katello_events"."process_after" IS NULL OR "katello_events"."process_after" BETWEEN $1 AND $2) AND "katello_events"."in_progress" = $3 ORDER BY "katello_events"."created_at" ASC LIMIT $4 [["process_after", "4713-01-01 BC"], ["process_after", "2023-05-26 09:08:24.348082"], ["in_progress", false], ["LIMIT", 1]]
2023-05-26T11:08:27 [D|sql|1ea14cc1] Katello::Event Load (0.4ms) SELECT "katello_events".* FROM "katello_events" WHERE ("katello_events"."process_after" IS NULL OR "katello_events"."process_after" BETWEEN $1 AND $2) AND "katello_events"."in_progress" = $3 ORDER BY "katello_events"."created_at" ASC LIMIT $4 [["process_after", "4713-01-01 BC"], ["process_after", "2023-05-26 09:08:27.351387"], ["in_progress", false], ["LIMIT", 1]]
~~~
It turned out that the observed behavior is due to the code in /usr/share/gems/gems/foreman_ansible-7.0.4.1/app/controllers/api/v2/ansible_override_values_controller.rb on the Satellite server. The code refers to the 'edit_external_variables' permission instead of the 'edit_ansible_variables' permission.
Editing /usr/share/gems/gems/foreman_ansible-7.0.4.1/app/controllers/api/v2/ansible_override_values_controller.rb on the Satellite server, and changing the following line:
~~~
@ansible_variable = AnsibleVariable.authorized(:edit_external_variables).
~~~
to:
~~~
@ansible_variable = AnsibleVariable.authorized(:edit_ansible_variables).
~~~
then restarting the Satellite services:
~~~
# satellite-maintain service restart
~~~
resolved the issue:
~~~
# export JSON_STRING='{"ansible_variable_id": "1", "override_value": { "match": "fqdn=client.example.com", "value": { "purge_unmanaged_files": true }}}'
# curl -v -k -X POST -u user_123:password_123 -H "Content-Type:application/json" -d "$JSON_STRING" https://satellite.example.com/ansible/api/ansible_override_values --insecure
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 10.37.195.118...
* TCP_NODELAY set
* Connected to satellite.example.com (10.37.195.118) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, [no content] (0):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, [no content] (0):
* TLSv1.3 (IN), TLS handshake, Request CERT (13):
* TLSv1.3 (IN), TLS handshake, [no content] (0):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, [no content] (0):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, [no content] (0):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, [no content] (0):
* TLSv1.3 (OUT), TLS handshake, Certificate (11):
* TLSv1.3 (OUT), TLS handshake, [no content] (0):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: C=US; ST=North Carolina; O=Katello; OU=SomeOrgUnit; CN=satellite.example.com
* start date: Apr 27 14:54:00 2023 GMT
* expire date: Jan 18 14:54:01 2038 GMT
* issuer: C=US; ST=North Carolina; L=Raleigh; O=Katello; OU=SomeOrgUnit; CN=satellite.example.com
* SSL certificate verify ok.
* Server auth using Basic with user 'user_03508223'
* TLSv1.3 (OUT), TLS app data, [no content] (0):
> POST /ansible/api/ansible_override_values HTTP/1.1
> Host: satellite.example.usersys.redhat.com
> Authorization: Basic dXNlcl8wMzUwODIyMzp1c2VyMTIz
> User-Agent: curl/7.61.1
> Accept: */*
> Content-Type:application/json
> Content-Length: 144
>
* upload completely sent off: 144 out of 144 bytes
* TLSv1.3 (IN), TLS handshake, [no content] (0):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, [no content] (0):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS app data, [no content] (0):
< HTTP/1.1 200 OK
< Date: Fri, 26 May 2023 09:52:17 GMT
< Server: Apache
< Foreman_version: 3.1.1.26
< Foreman_api_version: 2
< Foreman_current_organization: ; ANY
< Foreman_current_location: ; ANY
< Content-Type: application/json; charset=utf-8
< ETag: W/"00cf32e5b68db1ce5afbaa93dea0a202"
< Cache-Control: max-age=0, private, must-revalidate
< X-Request-Id: b41ccc1d-6a03-4cc1-911d-4ae4db7270a0
< X-Runtime: 0.328259
< Strict-Transport-Security: max-age=631139040; includeSubdomains
< X-Frame-Options: sameorigin
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< X-Download-Options: noopen
< X-Permitted-Cross-Domain-Policies: none
< Content-Security-Policy: default-src 'self'; child-src 'self'; connect-src 'self' ws: wss:; img-src 'self' data:; script-src 'unsafe-eval' 'unsafe-inline' 'self'; style-src 'unsafe-inline' 'self'
< Set-Cookie: _session_id=c8554b86386b11d113e502ddb3ddb1b0; path=/; secure; HttpOnly; SameSite=Lax
< Via: 1.1 satellite.example.com
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
<
* Connection #0 to host satellite.example.com left intact
{"id":2,"match":"fqdn=satellite.example.com","value":{"purge_unmanaged_files":true}}
~~~
While the reported issue pertains to the API, it is essentially the same problem as the one reported in BZ #2181595. Once we resolve this issue, it will fix the problem for both the API and the web UI. *** This bug has been marked as a duplicate of bug 2181595 *** |