Bug 1110431 - Satellite6 should error when the user attempts to sort on a non-sortable field
Summary: Satellite6 should error when the user attempts to sort on a non-sortable field
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API - Content
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Adam Price
QA Contact: sthirugn@redhat.com
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-17 15:53 UTC by sthirugn@redhat.com
Modified: 2019-09-26 18:12 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-14 17:09:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 6573 0 None None None 2016-04-22 16:14:10 UTC
Red Hat Product Errata RHSA-2015:1592 0 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 09:04:35 UTC

Description sthirugn@redhat.com 2014-06-17 15:53:56 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:

# hammer activation-key list --organization-id=1 --by='name'
---|--------------|----------------|-----------------------|-------------
ID | NAME         | CONSUMED       | LIFECYCLE ENVIRONMENT | CONTENT VIEW
---|--------------|----------------|-----------------------|-------------
8  | ak1234       | 0 of Unlimited |                       | cv1         
12 | ak12345678   | 0 of Unlimited |                       | cv1         
5  | actkey       | 0 of Unlimited | DEV                   | cv1         
1  | actkey1      | 1 of Unlimited | DEV                   | cv1         
4  | test1        | 0 of Unlimited |                       |             
7  | ak123        | 0 of Unlimited |                       | cv1         
11 | ak1234567    | 0 of Unlimited |                       | cv1         
14 | ak1234567890 | 0 of Unlimited |                       | cv1         
6  | ak           | 0 of Unlimited |                       | cv1         
9  | ak12345      | 0 of Unlimited | Library               | cv1         
10 | ak123456     | 0 of Unlimited |                       | cv1         
13 | ak123456789  | 0 of 100       |                       | cv1         
---|--------------|----------------|-----------------------|-------------

# hammer activation-key list --organization-id=1 --by='contentview'
---|--------------|----------------|-----------------------|-------------
ID | NAME         | CONSUMED       | LIFECYCLE ENVIRONMENT | CONTENT VIEW
---|--------------|----------------|-----------------------|-------------
8  | ak1234       | 0 of Unlimited |                       | cv1         
12 | ak12345678   | 0 of Unlimited |                       | cv1         
5  | actkey       | 0 of Unlimited | DEV                   | cv1         
1  | actkey1      | 1 of Unlimited | DEV                   | cv1         
4  | test1        | 0 of Unlimited |                       |             
7  | ak123        | 0 of Unlimited |                       | cv1         
11 | ak1234567    | 0 of Unlimited |                       | cv1         
14 | ak1234567890 | 0 of Unlimited |                       | cv1         
6  | ak           | 0 of Unlimited |                       | cv1         
9  | ak12345      | 0 of Unlimited | Library               | cv1         
10 | ak123456     | 0 of Unlimited |                       | cv1         
13 | ak123456789  | 0 of 100       |                       | cv1         
---|--------------|----------------|-----------------------|-------------

Actual results:
Note that the above two results does not change

Expected results:
The --by attribute should sort the results on the given field

Additional info:
I also tried the following commands and the result was same:

#hammer activation-key list --organization-id=1 --by='NAME'
#hammer activation-key list --organization-id=1 --by='CONTENT VIEW'

Comment 1 RHEL Program Management 2014-06-17 15:55:18 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 sthirugn@redhat.com 2014-06-17 15:57:44 UTC
Missed the following info:

Description of problem:
hammer activation-key list --by does not work 

Version-Release number of selected component (if applicable):
* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.19-1.el6_5.noarch
* candlepin-scl-1-5.el6_4.noarch
* candlepin-scl-quartz-2.1.5-5.el6_4.noarch
* candlepin-scl-rhino-1.7R3-1.el6_4.noarch
* candlepin-scl-runtime-1-5.el6_4.noarch
* candlepin-selinux-0.9.19-1.el6_5.noarch
* candlepin-tomcat6-0.9.19-1.el6_5.noarch
* elasticsearch-0.90.10-4.el6sat.noarch
* foreman-1.6.0.17-1.el6sat.noarch
* foreman-compute-1.6.0.17-1.el6sat.noarch
* foreman-gce-1.6.0.17-1.el6sat.noarch
* foreman-libvirt-1.6.0.17-1.el6sat.noarch
* foreman-ovirt-1.6.0.17-1.el6sat.noarch
* foreman-postgresql-1.6.0.17-1.el6sat.noarch
* foreman-proxy-1.6.0.7-1.el6sat.noarch
* foreman-selinux-1.6.0-4.el6sat.noarch
* foreman-vmware-1.6.0.17-1.el6sat.noarch
* katello-1.5.0-26.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.5-1.el6sat.noarch
* katello-installer-0.0.48-1.el6sat.noarch
* openldap-2.4.23-32.el6_4.1.x86_64
* pulp-katello-0.3-3.el6sat.noarch
* pulp-nodes-common-2.4.0-0.20.beta.el6sat.noarch
* pulp-nodes-parent-2.4.0-0.20.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.0-0.20.beta.el6sat.noarch
* pulp-puppet-tools-2.4.0-0.20.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.0-0.20.beta.el6sat.noarch
* pulp-selinux-2.4.0-0.20.beta.el6sat.noarch
* pulp-server-2.4.0-0.20.beta.el6sat.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
* ruby193-rubygem-runcible-1.1.0-2.el6sat.noarch


How reproducible:
Always

Comment 4 Adam Price 2014-07-02 22:04:39 UTC
@suresh, the syntax of using `--by` is incorrect now. i think it may have been in place at one time, but it has been removed in favor of the `--order` option, so i apologize if a doc didn't get updated somewhere.

In the case of your examples, your commands should look like the following:

hammer activation-key list --organization-id=1 --order='name ASC'

hammer activation-key list --organization-id=1 --order='content view ASC'


We don't have any kind of mechanism to let you know which fields are sortable and which fields are not, currently. Most objects in sat6 are sortable only by name at this time, which is also true for activation-keys. So attempting to sort by content view will result in an empty response from the server. i would prefer the server to respond with "Activation Keys cannot be sorted by 'content view'" or something to that effect.

Comment 5 sthirugn@redhat.com 2014-07-03 14:15:04 UTC
@Adam, I agree to your recommendations in Comment 4.

Also if --by option does not work anymore, please update the doc also. Currently it shows:

# hammer activation-key list --help
Usage:
    hammer activation-key list [OPTIONS]

Options:
    --by BY                       Field to sort the results on
    --content-view CONTENT_VIEW_NAME  
    --content-view-id CONTENT_VIEW_ID content view identifier
    --environment ENVIRONMENT_NAME  
    --environment-id ENVIRONMENT_ID environment identifier
    --full-results FULL_RESULTS   Whether or not to show all results
    --name NAME                   activation key name to filter by
    --order ORDER                 Sort field and order, eg. 'name DESC'
    --organization ORGANIZATION_NAME  
    --organization-id ORGANIZATION_ID organization identifier
    --organization-label ORGANIZATION_LABEL  
    --page PAGE                   Page number, starting at 1
    --per-page PER_PAGE           Number of results per page to return
    --search SEARCH               Search string
    -h, --help                    print help

Comment 6 Adam Price 2014-07-10 19:37:57 UTC
Created redmine issue http://projects.theforeman.org/issues/6573 from this bug

Comment 7 Adam Price 2014-07-14 23:48:32 UTC
https://github.com/Katello/katello/pull/4420

Comment 8 Bryan Kearney 2014-08-04 14:03:15 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/6573 has been closed
-------------
Anonymous
Applied in changeset commit:katello|3ec51c074a3decb6656f85195d98b39f57ccf430.

Comment 11 Adam Price 2014-08-06 21:00:50 UTC
i'm reverting this commit because it's appearing to cause more problems than improve upon our sorting.

walden pinged me about two separate times where this is preventing him from fixing or reproducing a bug.

i'd prefer to revert it, and solve the problem in such a way that doesn't break other things.

https://github.com/Katello/katello/pull/4540

Comment 13 sthirugn@redhat.com 2014-08-07 14:27:54 UTC
Failed in GA Snap 4. Also I heard from Adam Price that this fix creates some side effects.  

Adam Price and Michael Mccune will talk about reverting this fix.

hammer> hammer activation-key list --organization-id=3 --by='name'
Error: No such sub-command 'hammer'

See: ' --help'
hammer> activation-key list --organization-id=3 --by='name'
---|------|----------|-----------------------|-------------
ID | NAME | CONSUMED | LIFECYCLE ENVIRONMENT | CONTENT VIEW
---|------|----------|-----------------------|-------------
1  | ak1  | 1 of     | DEV                   | cv1         
2  | ak2  | 0 of     | Library               | cv1         
9  | ak3  | 0 of     |                       |             
10 | ak4  | 0 of     |                       |             
11 | ak5  | 0 of     |                       |             
12 | ak6  | 0 of     |                       |             
13 | ak7  | 0 of     | QE                    | cv1         
---|------|----------|-----------------------|-------------
hammer> activation-key list --organization-id=3 --by='contentview'
---|------|----------|-----------------------|-------------
ID | NAME | CONSUMED | LIFECYCLE ENVIRONMENT | CONTENT VIEW
---|------|----------|-----------------------|-------------
1  | ak1  | 1 of     | DEV                   | cv1         
2  | ak2  | 0 of     | Library               | cv1         
9  | ak3  | 0 of     |                       |             
10 | ak4  | 0 of     |                       |             
11 | ak5  | 0 of     |                       |             
12 | ak6  | 0 of     |                       |             
13 | ak7  | 0 of     | QE                    | cv1         
---|------|----------|-----------------------|-------------

Version Tested:
GA Snap 4 - Satellite-6.0.4-RHEL-6-20140806.0

Comment 17 sthirugn@redhat.com 2015-02-13 15:36:13 UTC
Failed.  The --by option still dont work.  I am not sure on what was actually fixed with this bug.  If we dont need --by option anymore, please remove it from hammer.  Please note --order option works fine.

Version Tested:
Satellite-6.1.0-RHEL-6-20150210.0

hammer> activation-key list --help
Usage:
     activation-key list [OPTIONS]

Options:
 --by BY                                             Field to sort the results on
 --content-view CONTENT_VIEW_NAME                    Content view name
 --content-view-id CONTENT_VIEW_ID                   content view numeric identifier
 --full-results FULL_RESULTS                         Whether or not to show all results
                                                     One of true/false, yes/no, 1/0.
 --lifecycle-environment LIFECYCLE_ENVIRONMENT_NAME  Name to search by
 --lifecycle-environment-id LIFECYCLE_ENVIRONMENT_ID  
 --name NAME                                         activation key name to filter by
 --order ORDER                                       Sort field and order, eg. 'name DESC'
 --organization ORGANIZATION_NAME                    Organization name to search by
 --organization-id ORGANIZATION_ID                   organization ID
 --organization-label ORGANIZATION_LABEL             Organization label to search by
 --page PAGE                                         Page number, starting at 1
 --per-page PER_PAGE                                 Number of results per page to return
 --search SEARCH                                     Search string
 -h, --help                                          print help

hammer> activation-key list --organization-id=1 --by='name'
---|------|----------------|-----------------------|--------------------------
ID | NAME | CONSUMED       | LIFECYCLE ENVIRONMENT | CONTENT VIEW             
---|------|----------------|-----------------------|--------------------------
1  | ak1  | 0 of Unlimited | Library               | Default Organization View
2  | ak2  | 0 of Unlimited |                       |                          
3  | ak3  | 0 of Unlimited |                       |                          
4  | ak4  | 0 of Unlimited |                       |                          
5  | ak5  | 0 of Unlimited |                       |                          
---|------|----------------|-----------------------|--------------------------

[FAILED SCENARIO]
hammer> activation-key list --organization-id=1 --by='content view'
---|------|----------------|-----------------------|--------------------------
ID | NAME | CONSUMED       | LIFECYCLE ENVIRONMENT | CONTENT VIEW             
---|------|----------------|-----------------------|--------------------------
1  | ak1  | 0 of Unlimited | Library               | Default Organization View
2  | ak2  | 0 of Unlimited |                       |                          
3  | ak3  | 0 of Unlimited | QE                    | cv3                      
4  | ak4  | 0 of Unlimited |                       |                          
5  | ak5  | 0 of Unlimited |                       |                          
---|------|----------------|-----------------------|--------------------------

--order works fine:

hammer> activation-key list --organization-id=1 --order='name asc'
---|------|----------------|-----------------------|--------------------------
ID | NAME | CONSUMED       | LIFECYCLE ENVIRONMENT | CONTENT VIEW             
---|------|----------------|-----------------------|--------------------------
1  | ak1  | 0 of Unlimited | Library               | Default Organization View
2  | ak2  | 0 of Unlimited |                       |                          
3  | ak3  | 0 of Unlimited | QE                    | cv3                      
4  | ak4  | 0 of Unlimited |                       |                          
5  | ak5  | 0 of Unlimited |                       |                          
---|------|----------------|-----------------------|--------------------------
hammer> activation-key list --organization-id=1 --order='name desc'
---|------|----------------|-----------------------|--------------------------
ID | NAME | CONSUMED       | LIFECYCLE ENVIRONMENT | CONTENT VIEW             
---|------|----------------|-----------------------|--------------------------
5  | ak5  | 0 of Unlimited |                       |                          
4  | ak4  | 0 of Unlimited |                       |                          
3  | ak3  | 0 of Unlimited | QE                    | cv3                      
2  | ak2  | 0 of Unlimited |                       |                          
1  | ak1  | 0 of Unlimited | Library               | Default Organization View
---|------|----------------|-----------------------|--------------------------
hammer> activation-key list --organization-id=1 --order='content view desc'
sort_order must be ASC or DESC.
hammer> activation-key list --organization-id=1 --order='contentview desc'
Unable to order by column 'contentview'.
hammer> activation-key list --organization-id=1 --order='contentview'
Unable to order by column 'contentview'.
hammer> activation-key list --organization-id=1 --order='id'
---|------|----------------|-----------------------|--------------------------
ID | NAME | CONSUMED       | LIFECYCLE ENVIRONMENT | CONTENT VIEW             
---|------|----------------|-----------------------|--------------------------
1  | ak1  | 0 of Unlimited | Library               | Default Organization View
2  | ak2  | 0 of Unlimited |                       |                          
3  | ak3  | 0 of Unlimited | QE                    | cv3                      
4  | ak4  | 0 of Unlimited |                       |                          
5  | ak5  | 0 of Unlimited |                       |                          
---|------|----------------|-----------------------|--------------------------
hammer> activation-key list --organization-id=1 --order='id desc'
---|------|----------------|-----------------------|--------------------------
ID | NAME | CONSUMED       | LIFECYCLE ENVIRONMENT | CONTENT VIEW             
---|------|----------------|-----------------------|--------------------------
5  | ak5  | 0 of Unlimited |                       |                          
4  | ak4  | 0 of Unlimited |                       |                          
3  | ak3  | 0 of Unlimited | QE                    | cv3                      
2  | ak2  | 0 of Unlimited |                       |                          
1  | ak1  | 0 of Unlimited | Library               | Default Organization View
---|------|----------------|-----------------------|--------------------------

Comment 19 errata-xmlrpc 2015-08-12 05:09:30 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-2015:1592

Comment 20 sthirugn@redhat.com 2015-08-14 20:43:30 UTC
Accidentally closed with 6.1.1 errata

Comment 21 Bryan Kearney 2015-08-25 17:24:20 UTC
Upstream bug component is API

Comment 22 Bryan Kearney 2016-08-10 19:00:44 UTC
Upstream bug component is API - Content

Comment 23 Bryan Kearney 2016-08-10 20:01:52 UTC
Upstream bug component is API

Comment 24 Bryan Kearney 2016-08-10 22:01:41 UTC
Upstream bug component is API - Content

Comment 25 Bryan Kearney 2017-03-14 17:09:30 UTC
An upstream issue has been opened for this. When this is fixed, the next version of satellite will contain the fix. We will no longer be tracking this downstream. If you feel this was closed in error, please feel free to re-open with additional information.


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