Bug 1202336 - auto-provision a host via normal user who has "Discovery_Manager" role assigned, rasies undefined method `transaction' for nil:NilClass
Summary: auto-provision a host via normal user who has "Discovery_Manager" role assign...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Discovery Plugin
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Lukas Zapletal
QA Contact: Sachin Ghai
URL:
Whiteboard:
Depends On:
Blocks: 1193977
TreeView+ depends on / blocked
 
Reported: 2015-03-16 12:41 UTC by Sachin Ghai
Modified: 2019-09-26 17:38 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:08:14 UTC
Target Upstream Version:


Attachments (Terms of Use)
Operation FAILED: undefined method `transaction' for nil:NilClass (60.65 KB, image/png)
2015-03-16 12:41 UTC, Sachin Ghai
no flags Details

Description Sachin Ghai 2015-03-16 12:41:33 UTC
Created attachment 1002243 [details]
Operation FAILED: undefined method `transaction' for nil:NilClass

Description of problem:
Created a user and assigned "discovery Manager" role to it. When  login with created user, I can see the discovered host.

But when I selected "auto_provision" from dropdown, I got following error in production.log:


--
2015-03-16 12:37:54 [I] Processing by DiscoveredHostsController#auto_provision as HTML
2015-03-16 12:37:54 [I]   Parameters: {"authenticity_token"=>"koGOJke03MsLI8HDVy1arpNmYfRxI1WGctnPfMpsczE=", "id"=>"mac52540032b2de"}
2015-03-16 12:37:54 [W] Operation FAILED: undefined method `transaction' for nil:NilClass
2015-03-16 12:37:54 [I]   Rendered common/500.html.erb within layouts/application (5.0ms)
2015-03-16 12:37:54 [I]   Rendered layouts/base.html.erb (1.4ms)
2015-03-16 12:37:54 [I] Completed 500 Internal Server Error in 48ms (Views: 8.7ms | ActiveRecord: 8.3ms)
--

Firebug on UI raises:

--"NetworkError: 500 Internal Server Error - https://dhcp201-163.englab.pnq.redhat.com/discovered_hosts/mac52540032b2de/auto_provision"
--


Version-Release number of selected component (if applicable):
sat6.1 beta snap6 compose2 (Satellite-6.1.0-RHEL-6-20150311.1).


How reproducible:
always

Steps to Reproduce:
1. Assign "discovery_Manger role to new created user
2. login with new user
3. try auto-provision

Actual results:
2015-03-16 12:37:54 [W] Operation FAILED: undefined method `transaction' for nil:NilClass

Expected results:
auto-provision should work

Additional info:

Comment 2 Lukas Zapletal 2015-03-17 14:22:50 UTC
Valid bug, medium severity (workaround is obvious). Looks like no permission to read hosts or something. We have two more permissions-related bugs this compose. We need to review them.

Comment 3 Lukas Zapletal 2015-06-22 14:24:54 UTC
Hello,

is this new Sat 6.1 instance or upgraded one? Once you reproduce, can you do:

foreman-rake:

Role.find_by_name("Discovery Manager").permissions

Comment 4 Lukas Zapletal 2015-06-22 14:29:12 UTC
Preferably:

Role.find_by_name("Discovery Manager").permissions.collect(&:name)

Expected result is:

["view_discovered_hosts", "provision_discovered_hosts", "edit_discovered_hosts", "destroy_discovered_hosts", "view_discovery_rules", "new_discovery_rules", "edit_discovery_rules", "execute_discovery_rules", "delete_discovery_rules"]

Nine of them.

Comment 5 Lukas Zapletal 2015-07-14 15:33:50 UTC
Took a chance and made big review of our permissions, found few other issues. Sachin see the description in the PR when testing this. This needs to be tested well.

Comment 7 Lukas Zapletal 2015-07-28 12:02:12 UTC
Sachin,

when testing this, test it please with both clean installation and upgrade from 6.0. In both cases please attach output of foreman-rake console output of these commands:

> Role.find_by_name("Discovery Manager").permissions.collect(&:name).sort
=> ["assign_locations",
 "assign_organizations",
 "auto_provision_discovered_hosts",
 "create_discovery_rules",
 "destroy_discovered_hosts",
 "destroy_discovery_rules",
 "edit_discovered_hosts",
 "edit_discovery_rules",
 "execute_discovery_rules",
 "provision_discovered_hosts",
 "submit_discovered_hosts",
 "view_discovered_hosts",
 "view_discovery_rules",
 "view_locations",
 "view_organizations"]

> Role.find_by_name("Discovery Reader").permissions.collect(&:name).sort
=> ["view_discovered_hosts", "view_discovery_rules", "view_locations", "view_organizations"]

These are permissions that are expected to appear. If something is missing in the upgraded case, we need to ask users to add those manually in the readme notes.

Comment 8 Lukas Zapletal 2015-07-28 14:48:49 UTC
Please disregard comment 6 and comment 7. This was fixed upstream, will be part of 6.2 rebase.

Comment 9 Lukas Zapletal 2016-05-12 15:40:37 UTC
This should be fixed in 6.2 beta.

Comment 10 Brad Buckingham 2016-05-12 17:36:50 UTC
Lukas,  Thanks!  I will pull in to 6.2 and move to ON_QA for verification.

Comment 11 Sachin Ghai 2016-05-31 09:11:51 UTC
Verified with Satellite6.2 GA snap13.1

The reported issue is no longer reproducible. I can auto-provision a host using normal user who has 'Discovery_Manager" role assigned.

Comment 12 Bryan Kearney 2016-07-27 11:08:14 UTC
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/RHBA-2016:1501


Note You need to log in before you can comment on or make changes to this bug.