Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1099557 - activation keys api - not filtering by lifecycle environment or content view any longer
Summary: activation keys api - not filtering by lifecycle environment or content view ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Management
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Dustin Tsang
QA Contact: Ales Dujicek
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-20 15:29 UTC by Tom McKay
Modified: 2019-09-25 20:32 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-02 14:06:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 5828 0 None None None 2016-04-22 15:52:36 UTC

Description Tom McKay 2014-05-20 15:29:45 UTC
Coding error in activation_keys_controller#index where the elasticsearch filters are incorrectly reset.

Comment 1 Tom McKay 2014-05-20 15:29:47 UTC
Created from redmine issue http://projects.theforeman.org/issues/5828

Comment 3 Og Maciel 2014-05-20 20:49:02 UTC
fwiw this issue also affects switching the content view from a content host via the web ui.

Comment 4 Bryan Kearney 2014-05-21 17:53:56 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/5828 has been closed

Comment 6 Ales Dujicek 2014-05-28 11:32:11 UTC
version: Satellite-6.0.3-RHEL-6-20140523.0

hammer activation-key list --organization-id 3
---|---------|----------------|-----------------------|--------------------------
ID | NAME    | CONSUMED       | LIFECYCLE ENVIRONMENT | CONTENT VIEW             
---|---------|----------------|-----------------------|--------------------------
2  | key2    | 0 of Unlimited | Library               | Default Organization View
5  | prodkey | 0 of Unlimited | prod                  |                          
1  | key1    | 0 of Unlimited | Library               | Default Organization View
4  | devkey2 | 0 of Unlimited | dev                   |                          
3  | devkey  | 0 of Unlimited | dev                   | cv1                      
---|---------|----------------|-----------------------|--------------------------


[OK] filter by content_view_id:
curl ... /katello/api/v2/organizations/3/activation_keys -d "content_view_id=4"
{"total":1,"subtotal":1,"page":1,"per_page":20,"search ...

curl ... /katello/api/v2/organizations/3/activation_keys -d "content_view_id=5"
{"total":0,"subtotal":0,"page":1,"per_page":20,"search":null,"sort":{"by":null,"order":null},"results":[]}

hammer --csv activation-key list --organization charlie --content-view-id 4
ID,Name,Consumed,Lifecycle Environment,Content View
3,devkey,0 of Unlimited,dev,cv1


[OK] filter by environment_id:
curl ... /katello/api/v2/organizations/3/activation_keys -d "environment_id=5"
{"total":1,"subtotal":1,"page":1,"per_page":20,"searc ...

curl ... /katello/api/v2/organizations/3/activation_keys -d "environment_id=4"
{"total":2,"subtotal":2,"page":1,"per_page":20," ...

hammer --csv activation-key list --organization charlie --environment-id 5
ID,Name,Consumed,Lifecycle Environment,Content View
5,prodkey,0 of Unlimited,prod,""


but api cannot filter by environment and cv names
and  hammer always returns all results


[failed] filter by environment:
curl ... /katello/api/v2/organizations/3/activation_keys -d "environment=Library"
{"displayMessage":"can't convert Symbol into Integer","errors":["can't convert Symbol into Integer"]}

hammer --csv activation-key list --organization charlie --environment Library
ID,Name,Consumed,Lifecycle Environment,Content View
2,key2,0 of Unlimited,Library,Default Organization View
5,prodkey,0 of Unlimited,prod,""
1,key1,0 of Unlimited,Library,Default Organization View
4,devkey2,0 of Unlimited,dev,""
3,devkey,0 of Unlimited,dev,cv1

[failed] filter by content_view:
curl ... /katello/api/v2/organizations/3/activation_keys -d "content_view=cv1"
{"total":5,"subtotal":5,"page":1,"per_pa ...
should be 1 ^^

hammer --csv activation-key list --organization charlie --content-view cv1 
ID,Name,Consumed,Lifecycle Environment,Content View
2,key2,0 of Unlimited,Library,Default Organization View
5,prodkey,0 of Unlimited,prod,""
1,key1,0 of Unlimited,Library,Default Organization View
4,devkey2,0 of Unlimited,dev,""
3,devkey,0 of Unlimited,dev,cv1

Comment 8 Tom McKay 2014-05-30 21:50:47 UTC

    [thomasmckay@thomasmckay hammer-cli-csv{threaded}]$ hammer activation-key list --organization-id 3 --content-view-id 4
    ----|------|----------------|-----------------------|-------------
    ID  | NAME | CONSUMED       | LIFECYCLE ENVIRONMENT | CONTENT VIEW
    ----|------|----------------|-----------------------|-------------
    119 | a    | 2 of Unlimited | Library               | a1          
    ----|------|----------------|-----------------------|-------------
    [thomasmckay@thomasmckay hammer-cli-csv{threaded}]$ hammer activation-key list --organization-id 3 --content-view a1
    Error: content_view found more than once
     
    HammerCLIForeman::ResolverError (content_view found more than once):
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/id_resolver.rb:144:in `pick_result'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/id_resolver.rb:139:in `find_resource'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/id_resolver.rb:117:in `get_id'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/id_resolver.rb:111:in `block (2 levels) in define_id_finders'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/commands.rb:96:in `get_resource_id'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/commands.rb:121:in `block in request_params'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/commands.rb:118:in `each'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/commands.rb:118:in `request_params'
        /home/thomasmckay/code/hammer-cli/lib/hammer_cli/apipie/command.rb:42:in `send_request'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/commands.rb:113:in `send_request'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/commands.rb:142:in `send_request'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/commands.rb:188:in `retrieve_and_print'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/commands.rb:175:in `browse_collection'
        /home/thomasmckay/code/hammer-cli-foreman/lib/hammer_cli_foreman/commands.rb:160:in `execute'
        /usr/local/rvm/gems/ruby-1.9.3-p448@hammer/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
        /home/thomasmckay/code/hammer-cli/lib/hammer_cli/abstract.rb:22:in `run'
        /usr/local/rvm/gems/ruby-1.9.3-p448@hammer/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute'
        /usr/local/rvm/gems/ruby-1.9.3-p448@hammer/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
        /home/thomasmckay/code/hammer-cli/lib/hammer_cli/abstract.rb:22:in `run'
        /usr/local/rvm/gems/ruby-1.9.3-p448@hammer/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute'
        /usr/local/rvm/gems/ruby-1.9.3-p448@hammer/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
        /home/thomasmckay/code/hammer-cli/lib/hammer_cli/abstract.rb:22:in `run'
        /usr/local/rvm/gems/ruby-1.9.3-p448@hammer/gems/clamp-0.6.3/lib/clamp/command.rb:125:in `run'
        /home/thomasmckay/code/hammer-cli/bin/hammer:100:in `<top (required)>'
        /usr/local/rvm/gems/ruby-1.9.3-p448@hammer/bin/hammer:23:in `load'
        /usr/local/rvm/gems/ruby-1.9.3-p448@hammer/bin/hammer:23:in `<main>'
        /usr/local/rvm/gems/ruby-1.9.3-p448@hammer/bin/ruby_executable_hooks:15:in `eval'
        /usr/local/rvm/gems/ruby-1.9.3-p448@hammer/bin/ruby_executable_hooks:15:in `<main>'

Comment 9 Dustin Tsang 2014-06-17 15:43:51 UTC
currently, filtering by --content-view works but --environment yields error message: "environment found more than once"

Comment 10 Dustin Tsang 2014-06-17 15:44:27 UTC
redmine issue created: 
http://projects.theforeman.org/issues/6253

Comment 11 Dustin Tsang 2014-06-17 17:56:15 UTC
The pull requests that fixes this issue:
https://github.com/Katello/hammer-cli-katello/pull/189

Comment 13 Ales Dujicek 2014-06-19 11:51:46 UTC
Verified - Satellite-6.0.3-RHEL-6-20140618.0

# hammer --csv activation-key list --organization 000org --content-view view
ID,Name,Consumed,Lifecycle Environment,Content View
28,key_lib_view,0 of Unlimited,Library,view
31,key_dev_view,0 of Unlimited,dev,view

# hammer --csv activation-key list --organization 000org --content-view-id 142
ID,Name,Consumed,Lifecycle Environment,Content View
28,key_lib_view,0 of Unlimited,Library,view
31,key_dev_view,0 of Unlimited,dev,view

# hammer --csv activation-key list --organization 000org --environment Library
ID,Name,Consumed,Lifecycle Environment,Content View
28,key_lib_view,0 of Unlimited,Library,view
27,key_lib_default,0 of Unlimited,Library,Default Organization View
26,key_lib,0 of Unlimited,Library,Default Organization View

# hammer --csv activation-key list --organization 000org --environment-id 132
ID,Name,Consumed,Lifecycle Environment,Content View
28,key_lib_view,0 of Unlimited,Library,view
27,key_lib_default,0 of Unlimited,Library,Default Organization View
26,key_lib,0 of Unlimited,Library,Default Organization View

Comment 14 Bryan Kearney 2014-07-02 14:06:06 UTC
This was delivered with 6.0.3, which is the Satellite 6 Beta.


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