Anytime a json containing "admin" is sent via PUT on users the request fails with: <pre> undefined method `admin=' for nil:NilClass (NoMethodError) </pre> The relevant backtrace is: <pre> 2015-03-09 09:57:27 [I] Started PUT "//api/users/13" for 127.0.0.1 at 2015-03-09 09:57:27 +0000 2015-03-09 09:57:27 [I] Processing by Api::V2::UsersController#update as JSON 2015-03-09 09:57:27 [I] Parameters: {"user"=>{"admin"=>"false"}, "apiv"=>"v2", "id"=>"13"} 2015-03-09 09:57:27 [D] ESC[1mESC[36mUser Load (0.2ms)ESC[0m ESC[1mSELECT "users".* FROM "users" WHERE "users"."lower_login" = 'admin' LIMIT 1ESC[0m 2015-03-09 09:57:27 [D] ESC[1mESC[35mAuthSource Load (0.1ms)ESC[0m SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = 1 LIMIT 1 2015-03-09 09:57:27 [D] ESC[1mESC[36mCACHE (0.0ms)ESC[0m ESC[1mSELECT "users".* FROM "users" WHERE "users"."lower_login" = 'admin' LIMIT 1ESC[0m 2015-03-09 09:57:27 [D] Authenticated user Admin User against INTERNAL authentication source 2015-03-09 09:57:27 [D] ESC[1mESC[35mUser Load (0.1ms)ESC[0m SELECT "users".* FROM "users" WHERE "users"."lower_login" = 'foreman_admin' LIMIT 1 2015-03-09 09:57:27 [D] Setting current user thread-local variable to foreman_admin 2015-03-09 09:57:27 [D] Setting current user thread-local variable to nil 2015-03-09 09:57:27 [D] ESC[1mESC[36mCACHE (0.0ms)ESC[0m ESC[1mSELECT "users".* FROM "users" WHERE "users"."lower_login" = 'foreman_admin' LIMIT 1ESC[0m 2015-03-09 09:57:27 [D] Setting current user thread-local variable to foreman_admin 2015-03-09 09:57:27 [D] ESC[1mESC[35m (0.0ms)ESC[0m begin transaction 2015-03-09 09:57:27 [D] ESC[1mESC[36m (0.2ms)ESC[0m ESC[1mUPDATE "users" SET "last_login_on" = '2015-03-09 09:57:27.507351', "updated_at" = '2015-03-09 09:57:27.507910' WHERE "users"."id" = 1ESC[0m 2015-03-09 09:57:27 [D] ESC[1mESC[35mRole Load (0.1ms)ESC[0m SELECT "roles".* FROM "roles" WHERE "roles"."name" = 'Anonymous' LIMIT 1 2015-03-09 09:57:27 [D] ESC[1mESC[36m (0.1ms)ESC[0m ESC[1mSELECT "roles".id FROM "roles" INNER JOIN "user_roles" ON "roles"."id" = "user_roles"."role_id" WHERE "user_roles"."owner_id" = 1 AND "user_roles"."owner_type" = 'User'ESC[0m 2015-03-09 09:57:27 [D] ESC[1mESC[35m (81.0ms)ESC[0m commit transaction 2015-03-09 09:57:27 [D] ESC[1mESC[36mCACHE (0.0ms)ESC[0m ESC[1mSELECT "roles".* FROM "roles" WHERE "roles"."name" = 'Anonymous' LIMIT 1ESC[0m 2015-03-09 09:57:27 [D] ESC[1mESC[35mRole Exists (0.1ms)ESC[0m 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" = 'User' AND "r oles"."id" = 8 LIMIT 1 2015-03-09 09:57:27 [D] Setting current user thread-local variable to nil 2015-03-09 09:57:27 [D] Setting current user thread-local variable to admin 2015-03-09 09:57:27 [D] ESC[1mESC[36mAuthSourceHidden Load (0.1ms)ESC[0m ESC[1mSELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."type" IN ('AuthSourceHidden')ESC[0m 2015-03-09 09:57:27 [D] ESC[1mESC[35mUser Load (0.1ms)ESC[0m SELECT "users".* FROM "users" WHERE "users"."lower_login" = 'admin' AND (users.auth_source_id <> 2) ORDER BY firstname LIMIT 1 2015-03-09 09:57:27 [I] Authorized user admin(Admin User) 2015-03-09 09:57:27 [D] Setting current user thread-local variable to admin 2015-03-09 09:57:27 [E] undefined method `admin=' for nil:NilClass (NoMethodError) /root/foreman/app/controllers/concerns/foreman/controller/users_mixin.rb:46:in `update_admin_flag' </pre>
Created from redmine issue http://projects.theforeman.org/issues/9678
Upstream bug assigned to tstrachota
Moving to POST since upstream bug http://projects.theforeman.org/issues/9678 has been closed ------------- Anonymous Applied in changeset commit:1b1b39861e485523b0cc0c6435fef30c38df7e07.
Verified against Satellite-6.1.0-RHEL-6-20150317.0 and Satellite-6.1.0-RHEL-7-20150317.0. An automated test for this bug will be added to QE's test suite shortly. See https://github.com/SatelliteQE/robottelo/pull/2004
This bug is slated to be released with Satellite 6.1.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2015:1592