Bug 1486227

Summary: Taxonomies of role filter are not updating through Hammer CLI
Product: Red Hat Satellite Reporter: Jitendra Yejare <jyejare>
Component: Users & RolesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3.0CC: bbuckingham, dhlavacd, mhulan
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:32:57 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:
Bug Depends On:    
Bug Blocks: 1373844    

Description Jitendra Yejare 2017-08-29 09:14:42 UTC
Description of problem:
Updating role to override the "filter with taxonomies" is broken. Taxonomies are not getting assigned to overridden filter.

Version-Release number of selected component (if applicable):
Satellite 6.2 Snap 13

How reproducible:
Always

Steps to Reproduce:
1. Create Role
2. Add filter(overridden/non-overridden) to the above role 
3.  From hammer CLI, attempt to update filter (with/without override flag and) assign some taxonomies

Commands:
#hammer filter update --id 493 --role-id 42 --override yes --organization-ids "1,3" --location-ids "2,4"
-> Permission filter for [Subnet] updated

Actual results:
1. The filter is set to overridden which is expected
2. Taxonomies of role filters are not updated

Expected results:
Taxonomies of role filter should be updated

Note:
This but is reproducible in both the cases when updating filter which is "not overridden or already overriden".

Logs:
/var/log/foreman/production.log:

2017-08-29 04:41:16 1eaba8c3 [app] [I] Started GET "/api/filters/493" for 10.16.4.58 at 2017-08-29 04:41:16 -0400
2017-08-29 04:41:16 1eaba8c3 [app] [I] Processing by Api::V2::FiltersController#show as JSON
2017-08-29 04:41:16 1eaba8c3 [app] [I]   Parameters: {"apiv"=>"v2", "id"=>"493", "filter"=>{}}
2017-08-29 04:41:16 1eaba8c3 [app] [I] Current user: foreman_admin (administrator)
2017-08-29 04:41:16 1eaba8c3 [app] [I] Current user: foreman_admin (administrator)
2017-08-29 04:41:16 1eaba8c3 [app] [I] Current user: admin (administrator)
2017-08-29 04:41:16 1eaba8c3 [app] [I] Authorized user admin(Admin User)
2017-08-29 04:41:16 1eaba8c3 [app] [I] Current user: admin (administrator)
2017-08-29 04:41:16 1eaba8c3 [app] [I]   Rendered api/v2/filters/show.json.rabl (11.7ms)
2017-08-29 04:41:16 1eaba8c3 [app] [I] Completed 200 OK in 46ms (Views: 11.4ms | ActiveRecord: 20.8ms)
2017-08-29 04:41:16 93e37b81 [app] [I] Started PUT "/api/filters/493" for 10.16.4.58 at 2017-08-29 04:41:16 -0400
2017-08-29 04:41:16 93e37b81 [app] [I] Processing by Api::V2::FiltersController#update as JSON
2017-08-29 04:41:16 93e37b81 [app] [I]   Parameters: {"filter"=>{"role_id"=>42, "organization_ids"=>[], "location_ids"=>[]}, "apiv"=>"v2", "id"=>"493"}
2017-08-29 04:41:16 93e37b81 [app] [I] Current user: foreman_admin (administrator)
2017-08-29 04:41:16 93e37b81 [app] [I] Current user: foreman_admin (administrator)
2017-08-29 04:41:16 93e37b81 [app] [I] Current user: admin (administrator)
2017-08-29 04:41:16 93e37b81 [app] [I] Authorized user admin(Admin User)
2017-08-29 04:41:16 93e37b81 [app] [I] Current user: admin (administrator)
2017-08-29 04:41:16 93e37b81 [app] [I]   Rendered api/v2/filters/update.json.rabl (5.6ms)
2017-08-29 04:41:16 93e37b81 [app] [I] Completed 200 OK in 48ms (Views: 6.3ms | ActiveRecord: 10.3ms)
2017-08-29 04:41:17 eb5c0b42 [app] [I] Started GET "/notification_recipients" for 10.76.33.235 at 2017-08-29 04:41:17 -0400
2017-08-29 04:41:17 eb5c0b42 [app] [I] Processing by NotificationRecipientsController#index as JSON
2017-08-29 04:41:17 eb5c0b42 [app] [I] Current user: admin (administrator)
2017-08-29 04:41:17 eb5c0b42 [app] [I] Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.7ms)
2017-08-29 04:41:27 9d7a7ee1 [app] [I] Started GET "/notification_recipients" for 10.76.33.235 at 2017-08-29 04:41:27 -0400
2017-08-29 04:41:27 9d7a7ee1 [app] [I] Processing by NotificationRecipientsController#index as JSON
2017-08-29 04:41:27 9d7a7ee1 [app] [I] Current user: admin (administrator)
2017-08-29 04:41:27 9d7a7ee1 [app] [I] Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.4ms)

Comment 2 Daniel Lobato Garcia 2017-08-31 12:04:46 UTC
Created redmine issue http://projects.theforeman.org/issues/20817 from this bug

Comment 4 Jitendra Yejare 2017-09-13 10:23:25 UTC
Same issue observed from API end.

Comment 5 Marek Hulan 2017-10-25 14:58:25 UTC
So, the incoming parameters are Parameters: {"filter"=>{"role_id"=>42, "organization_ids"=>[], "location_ids"=>[]} which indicates hammer did not send those values. This was already fixed in upstream by https://github.com/theforeman/hammer-cli-foreman/pull/313 and released in hammer-cli-foreman 0.11.

Comment 7 Jitendra Yejare 2017-10-25 15:19:35 UTC
Verified !

@Satellite 6.3 Snap 21

Steps:
1. Created Role
2. Added filter(overridden/non-overridden) to the above role 
3. From hammer CLI, updated filter to assign some taxonomies

Result:
Taxonomies of role filters are updated

Comment 8 Bryan Kearney 2018-02-21 16:32:57 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/RHSA-2018:0336