You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Tom Beerbower (JIRA)" <ji...@apache.org> on 2015/05/15 21:29:00 UTC

[jira] [Updated] (AMBARI-11183) Views : "cannot load permission" error when accessing the ambari view

     [ https://issues.apache.org/jira/browse/AMBARI-11183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom Beerbower updated AMBARI-11183:
-----------------------------------
    Description: 
"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)
{code}


  was:
"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}


> 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)
> {code}



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