Bug 1296782 - Executing "hammer role filters" command throws SQL errors
Summary: Executing "hammer role filters" command throws SQL errors
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Search
Version: 6.1.4
Hardware: All
OS: Linux
high
high vote
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Katello QA List
URL: http://projects.theforeman.org/issues...
Whiteboard:
: 1368408 (view as bug list)
Depends On:
Blocks: 1479962
TreeView+ depends on / blocked
 
Reported: 2016-01-08 02:40 UTC by Nagoor Shaik
Modified: 2021-03-11 14:27 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:17 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 13064 0 None None None 2016-07-21 17:45:57 UTC
Foreman Issue Tracker 13645 0 None None None 2016-08-23 12:06:12 UTC
Red Hat Knowledge Base (Solution) 2115741 0 None None None 2016-01-08 03:14:08 UTC

Description Nagoor Shaik 2016-01-08 02:40:40 UTC
Description of problem:
Executing "hammer role filters" command throws SQL errors

Version-Release number of selected component (if applicable):
foreman-1.7.2.46-1.el7sat.noarch
foreman-compute-1.7.2.46-1.el7sat.noarch
foreman-debug-1.7.2.46-1.el7sat.noarch
foreman-gce-1.7.2.46-1.el7sat.noarch
foreman-libvirt-1.7.2.46-1.el7sat.noarch
foreman-ovirt-1.7.2.46-1.el7sat.noarch
foreman-postgresql-1.7.2.46-1.el7sat.noarch
foreman-proxy-1.7.2.6-1.el7sat.noarch
foreman-selinux-1.7.2.16-1.el7sat.noarch
foreman-vmware-1.7.2.46-1.el7sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.13-1.el7sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.19-1.el7sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.24-1.el7sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el7sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el7sat.noarch
ruby193-rubygem-foreman-redhat_access-0.2.3-1.el7sat.noarch
ruby193-rubygem-foreman-tasks-0.6.15.7-1.el7sat.noarch
rubygem-hammer_cli-0.1.4.13-1.el7sat.noarch
rubygem-hammer_cli_foreman-0.1.4.14-1.el7sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el7sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el7sat.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.9-1.el7sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.5-1.el7sat.noarch
rubygem-hammer_cli_gutterball-0.0.1.3-1.el7sat.noarch
rubygem-hammer_cli_import-0.10.20-1.el7sat.noarch
rubygem-hammer_cli_katello-0.0.7.18-1.el7sat.noarch


How reproducible:
100 %

Steps to Reproduce:
1. Execute hammer role filters
     
# hammer role filters
PGError: ERROR:  invalid input syntax for integer: ""
LINE 1: ..."id" = "filters"."role_id" WHERE (("roles"."id" = '')) ORDER...
                                                             ^
: SELECT  "filters"."id" AS t0_r0, "filters"."search" AS t0_r1, "filters"."role_id" AS t0_r2, "filters"."created_at" AS t0_r3, "filters"."updated_at" AS t0_r4, "filters"."taxonomy_search" AS t0_r5, "roles"."id" AS t1_r0, "roles"."name" AS t1_r1, "roles"."builtin" AS t1_r2, "roles"."permissions" AS t1_r3 FROM "filters" LEFT OUTER JOIN "roles" ON "roles"."id" = "filters"."role_id" WHERE (("roles"."id" = '')) ORDER BY role_id, filters.id LIMIT 20 OFFSET 0

Actual results:
Throws SQL errors when executing the command

Expected results:
Ideally it should display a warning stating that ID of the role is missing

Additional info:
"hammer role filters" command is expecting an ID to be passed in with the command, if it finds NULL then it throws the above SQL error. 

  # hammer role list
---|-----------------------
ID | NAME                  
---|-----------------------
1  | Discovery Reader      
2  | Discovery Manager     
3  | Tasks Manager         
4  | Tasks Reader          
5  | Red Hat Access Logs   
6  | Access Insights Viewer
7  | Access Insights Admin 
8  | Boot disk access      
9  | Manager               
10 | Edit partition tables 
11 | View hosts            
12 | Edit hosts            
13 | Viewer                
14 | Site manager          
15 | Default user          
16 | Anonymous             
17 | Admin                 
---|-----------------------

  # hammer role filter --id 1 ---> This command works fine
---|---------------|--------|------------|------------------|----------------------
ID | RESOURCE TYPE | SEARCH | UNLIMITED? | ROLE             | PERMISSIONS          
---|---------------|--------|------------|------------------|----------------------
1  | Location      | none   | yes        | Discovery Reader | view_locations       
2  | Organization  | none   | yes        | Discovery Reader | view_organizations   
3  | Host          | none   | yes        | Discovery Reader | view_discovered_hosts
4  | DiscoveryRule | none   | yes        | Discovery Reader | view_discovery_rules 
---|---------------|--------|------------|------------------|----------------------

Comment 3 Bryan Kearney 2016-01-26 13:55:35 UTC
Moving this out of 6.1.7 due to capacity issues. Will keep it on the 6.1.z and 6.2 trackers to ensure that it is evaluated for both.

Comment 7 Brad Buckingham 2016-03-16 15:26:07 UTC
Created redmine issue http://projects.theforeman.org/issues/14235 from this bug

Comment 8 Bryan Kearney 2016-03-16 16:13:11 UTC
Upstream bug component is Provisioning

Comment 9 Ranjan Kumar 2016-04-12 07:40:11 UTC
patch added http://projects.theforeman.org/issues/13064

Comment 14 Bryan Kearney 2016-08-10 19:12:41 UTC
Upstream bug component is Search

Comment 15 Bryan Kearney 2016-08-10 20:13:40 UTC
Upstream bug component is Provisioning

Comment 16 Bryan Kearney 2016-08-10 22:13:19 UTC
Upstream bug component is Search

Comment 17 Bryan Kearney 2016-08-23 11:43:43 UTC
*** Bug 1368408 has been marked as a duplicate of this bug. ***

Comment 19 Karl Abbott 2017-04-12 19:21:47 UTC
any chance we can get a target 6.2.z for this one?

Karl

Comment 23 Stanislav Tkachenko 2017-06-06 06:50:54 UTC
Verified on Sat 6.3 Snap 1.0 with automation test:

2017-06-06 09:48:45 - robottelo.ssh - INFO - >>> LANG=en_US.UTF-8  hammer -v -u admin -p changeme --output=json role filters 
2017-06-06 09:48:47 - robottelo.ssh - INFO - <<< stderr
[ERROR 2017-06-06 02:48:47 Exception] Error: At least one of options --name, --id is required

See: 'hammer role filters --help'

Comment 26 Satellite Program 2018-02-21 16:54:17 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


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