Bug #14235
closedExecuting "hammer role filters" command throws SQL errors
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1296782
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
---|---------------|--------|------------|------------------|----------------------
Updated by Dominic Cleal over 8 years ago
- Is duplicate of Bug #13645: Scoped search fails with 500 on postgresql if value can't be converted added
Updated by Ranjan Kumar over 8 years ago
- Is duplicate of Bug #13064: Executing "hammer role filters" command throws SQL errors added