ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Beerbower (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AMBARI-11183) Views : "cannot load permission" error when accessing the ambari view
Date Fri, 15 May 2015 19:27:01 GMT
Tom Beerbower created AMBARI-11183:
--------------------------------------

             Summary: Views : "cannot load permission" error when accessing the ambari view
                 Key: AMBARI-11183
                 URL: https://issues.apache.org/jira/browse/AMBARI-11183
             Project: Ambari
          Issue Type: Task
            Reporter: Tom Beerbower
            Assignee: Tom Beerbower
             Fix For: 2.1.0


"cannot load permission" error when accessing the ambari view

The problem is that there are privileges in the DB that do not have an associated resource.

To reproduce:
Delete jars of views which have an instance left in ambari, from /var/lib/ambari-server/resources/views/
and restart ambari. 

{code}
mysql> select * from adminprivilege left join adminresource on adminprivilege.resource_id
= adminresource.resource_id where 
adminresource.resource_id is null;
+--------------+---------------+-------------+--------------+-------------+------------------+
| privilege_id | permission_id | resource_id | principal_id | resource_id | resource_type_id
|
+--------------+---------------+-------------+--------------+-------------+------------------+
|           46 |             4 |           7 |            9 |        NULL |             NULL
|
|           47 |             4 |           7 |         1003 |        NULL |             NULL
|
+--------------+---------------+-------------+--------------+-------------+------------------+
2 rows in set (0.00 sec)

mysql> select * from adminresource;
+-------------+------------------+
| resource_id | resource_type_id |
+-------------+------------------+
|           1 |                1 |
|           3 |                2 |
|           4 |                5 |
|           8 |               12 |
|           6 |                8 |
+-------------+------------------+
5 rows in set (0.00 sec)
This results in a NPE in line where getResource() is empty.
          switch (privilegeEntity.getResource().getResourceType().getId()) {
Verified this with Alejandro Fernandez and the solution is basically to remove the privilege
that does not have an corresponding resource. This can be removed by running
delete from adminprivilege where privilege_id=46
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message