Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 835591

Summary: activation-key --limit not working
Product: Red Hat Satellite Reporter: Garik Khachikyan <gkhachik>
Component: APIAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Og Maciel <omaciel>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: dmacpher, mkoci, mmccune, omaciel, snansi
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
The --limit option of the `katello activation_key` command reported an error when used. This fix sets the --limit option to accept integer values. The error no longer appears.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 19:46:56 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:

Description Garik Khachikyan 2012-06-26 14:33:30 UTC
Description of problem:
invoking: `activation_key create --name test --org ACME_Corporation --environment dev --limit 1` fails with exception:
---
Wrong/Invalid parameters sent for api/activation_keys/create.
 Wrong Parameters: 
[{"activation_key"=>["usage_limit"]}]
 Parameters Received:
 {"activation_key"=>{"usage_limit"=>"1", "description"=>nil, "name"=>"test"}, "action"=>"create", "controller"=>"api/activation_keys", "environment_id"=>"7"}
---

Version-Release number of selected component (if applicable):
Recent Katello:
--
pulp-common-1.1.10-1.el6.noarch
qpid-cpp-server-ssl-0.14-14.el6_2.x86_64
katello-glue-candlepin-0.2.41-1.git.23.9a2ef30.el6.noarch
katello-repos-testing-0.2.4-1.el6.noarch
pulp-1.1.10-1.el6.noarch
katello-configure-0.2.27-1.git.1.039c665.el6.noarch
candlepin-tomcat6-0.5.32-1.el6.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
katello-cli-common-0.2.41-1.git.0.6ef074b.el6.noarch
katello-cli-0.2.41-1.git.0.6ef074b.el6.noarch
m2crypto-0.21.1.pulp-7.el6.x86_64
mod_wsgi-3.3-3.pulp.el6.x86_64
python-qpid-0.14-7.el6_2.noarch
qpid-cpp-client-ssl-0.14-14.el6_2.x86_64
katello-glue-pulp-0.2.41-1.git.23.9a2ef30.el6.noarch
pulp-selinux-server-1.1.10-1.el6.noarch
katello-qpid-client-key-pair-1.0-1.noarch
katello-agent-1.0.3-1.git.0.cccd0b4.el6.noarch
candlepin-0.5.32-1.el6.noarch
qpid-cpp-server-0.14-14.el6_2.x86_64
katello-glue-foreman-0.2.41-1.git.23.9a2ef30.el6.noarch
katello-0.2.41-1.git.23.9a2ef30.el6.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
python-oauth2-1.5.170-2.pulp.el6.noarch
katello-certs-tools-1.1.6-1.git.0.4878f30.el6.noarch
qpid-cpp-client-0.14-14.el6_2.x86_64
katello-common-0.2.41-1.git.23.9a2ef30.el6.noarch
katello-repos-0.2.4-1.el6.noarch
katello-selinux-0.2.5-1.git.0.cc457ee.el6.noarch
--

How reproducible:
always

Steps to Reproduce:
1.just prepare org, env.
2.invoke command in description
3.
  
Actual results:
failure

Expected results:
no failure. the AK with usage limit specified should get prepared.

Additional info:

Comment 1 Lukas Zapletal 2012-06-26 16:10:09 UTC
Is this testing build or stable build?

Comment 2 Garik Khachikyan 2012-06-27 11:15:33 UTC
it's (actually was) yesterday's Katello built right from github (not fedorahosted).

Comment 3 Lukas Zapletal 2012-06-27 14:14:08 UTC
[root@zone ~]# kk activation_key create --name test --org ACME_Corporation --environment dev --limit 1
Successfully created activation key [ test ]

[root@zone ~]# versions
katello-0.2.42-1.git.9.fc18833.el6.noarch
katello-cli-0.2.41-1.git.0.6ef074b.el6.noarch
katello-agent-1.0.3-1.git.0.cccd0b4.el6.noarch
pulp-1.1.10-1.el6.noarch
candlepin-0.5.32-1.el6.noarch
subscription-manager-0.99.14-1.el6.x86_64
python-rhsm-0.99.8-1.el6.noarch
yum-3.2.29-22.el6.noarch

Most likely old katello package.

katello-0.2.41-1.git.23.9a2ef30.el6.noarch
VS
katello-0.2.42-1.git.9.fc18833.el6.noarch

Can you please try with recent nightly or git?

Comment 4 Lukas Zapletal 2012-06-27 14:14:59 UTC
The next nightly should work Garik, please retest and close if not valid. Thanks.

Comment 6 Garik Khachikyan 2012-07-02 13:11:30 UTC
this particular issue now works, but i have another one: 

value -1 works and then it allows system to be registered by that key. like:
---
Id:                 51
Name:               test2
Description:
    None
Usage:              1/-1
Environment Id:     85
System Template Id: None
---

I think would be better to have a check telling: >0

Comment 7 Lukas Zapletal 2012-07-04 08:28:59 UTC
Yeah -1 means unlimited, I am going to hide this from the CLI. It should be hidden.

Comment 8 Garik Khachikyan 2012-08-30 07:54:42 UTC
qe-acking

Comment 9 Lukas Zapletal 2012-09-04 12:17:58 UTC
https://github.com/Katello/katello/pull/576

Comment 11 Og Maciel 2012-10-04 21:39:28 UTC
# katello -u admin -p admin activation_key create --name test --org "Tupinambá" --environment Mild --limit 1
Successfully created activation key [ test ]

Comment 12 Og Maciel 2012-10-04 21:40:37 UTC
Verified using:

* candlepin-0.7.8-1.el6cf.noarch
* candlepin-selinux-0.7.8-1.el6cf.noarch
* candlepin-tomcat6-0.7.8-1.el6cf.noarch
* katello-1.1.12-12.el6cf.noarch
* katello-all-1.1.12-12.el6cf.noarch
* katello-candlepin-cert-key-pair-1.0-1.noarch
* katello-certs-tools-1.1.8-1.el6cf.noarch
* katello-cli-1.1.8-6.el6cf.noarch
* katello-cli-common-1.1.8-6.el6cf.noarch
* katello-common-1.1.12-12.el6cf.noarch
* katello-configure-1.1.9-6.el6cf.noarch
* katello-glue-candlepin-1.1.12-12.el6cf.noarch
* katello-glue-pulp-1.1.12-12.el6cf.noarch
* katello-qpid-broker-key-pair-1.0-1.noarch
* katello-qpid-client-key-pair-1.0-1.noarch
* katello-selinux-1.1.1-1.el6cf.noarch
* pulp-1.1.12-1.el6cf.noarch
* pulp-common-1.1.12-1.el6cf.noarch
* pulp-selinux-server-1.1.12-1.el6cf.noarch

Comment 14 errata-xmlrpc 2012-12-04 19:46:56 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.

http://rhn.redhat.com/errata/RHSA-2012-1543.html