Bug 845995 - CLI: wrong error when activation key name or system group name is wrong.
Summary: CLI: wrong error when activation key name or system group name is wrong.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: Unspecified
Assignee: Miroslav Suchý
QA Contact: Hayk Hovsepyan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-06 12:35 UTC by Hayk Hovsepyan
Modified: 2019-09-25 21:11 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Specifying a nonexistent system group when adding a system group to an activation key on the command line resulted in a misleading error message: "error: list index out of range (more in the log file /var/log/katello/client.log)" This fix adds local and server-side to validate and specify which activation key or system group produces the error and report it.
Clone Of:
Environment:
Last Closed: 2012-12-04 19:53:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:1543 0 normal SHIPPED_LIVE Important: CloudForms System Engine 1.1 update 2012-12-05 00:39:57 UTC

Description Hayk Hovsepyan 2012-08-06 12:35:17 UTC
Description of problem:
Try to add system group to activation key by CLI.
When you specify non existing system group name or non existing activation key name while assigning system group to activation key, it shows wrong error message:"error: list index out of range (more in the log file /var/log/katello/client.log)"

In client.log file it prints:
"  File "/usr/lib/python2.6/site-packages/katello/client/core/activation_key.py", line 315, in run
    system_group = system_group[0]
IndexError: list index out of range"

Version-Release number of selected component (if applicable):
python-qpid-0.14-7.el6_2.noarch
katello-common-1.1.3-1.el6.noarch
qpid-cpp-server-ssl-0.14-14.el6_2.x86_64
candlepin-tomcat6-0.5.35-1.el6.noarch
katello-1.1.3-1.el6.noarch
katello-configure-1.1.2-1.el6.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
katello-cli-common-1.0.1-1.el6.noarch
katello-cli-1.0.1-1.el6.noarch
katello-repos-1.1.1-1.el6.noarch
mod_wsgi-3.3-3.pulp.el6.x86_64
katello-glue-pulp-1.1.3-1.el6.noarch
qpid-cpp-client-ssl-0.14-14.el6_2.x86_64
katello-selinux-1.0.1-1.el6.noarch
katello-qpid-client-key-pair-1.0-1.noarch
katello-agent-1.0.6-1.el6.noarch
python-oauth2-1.5.170-2.pulp.el6.noarch
pulp-common-1.1.11-1.el6.noarch
katello-glue-candlepin-1.1.3-1.el6.noarch
qpid-cpp-server-0.14-14.el6_2.x86_64
pulp-1.1.11-1.el6.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
m2crypto-0.21.1.pulp-7.el6.x86_64
katello-certs-tools-1.1.7-1.el6.noarch
katello-glue-foreman-1.1.3-1.el6.noarch
candlepin-0.5.35-1.el6.noarch
qpid-cpp-client-0.14-14.el6_2.x86_64
pulp-selinux-server-1.1.11-1.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. Create an activation key.
2. Create a system group.
3. Try to assign some wrong system group to created activation key: "activation_key add_system_group --name $wrongname --system_group $systemgroupname --org ACME_Corporation". You will see strange error. This is bug.
4. Try to assign existing system group to wrong activation key. The same error.
  
Actual results:
System throws some array index out of range error when activation key or system group name does not exist.

Expected results:
Sit should check does activation key or system group exists. If not, show message that they are not found.

Comment 1 Hayk Hovsepyan 2012-08-06 12:40:07 UTC
The same when you remove system group from activation key.
"activation_key remove_system_group --name $wrongname --system_group $wrongname --org ACME_Corporation"

Comment 2 Mike McCune 2012-08-24 18:23:44 UTC
https://github.com/Katello/katello/pull/504

Comment 3 Miroslav Suchý 2012-08-26 17:46:36 UTC
Syntax error fixed in:
https://github.com/Katello/katello/pull/515

Comment 5 Hayk Hovsepyan 2012-09-18 12:58:25 UTC
Tested on revision:

katello-cli-1.1.8-4.el6cf.noarch
katello-certs-tools-1.1.8-1.el6cf.noarch
candlepin-selinux-0.7.8-1.el6cf.noarch
qpid-cpp-server-ssl-0.14-14.el6_2.x86_64
pulp-selinux-server-1.1.12-1.el6cf.noarch
katello-glue-pulp-1.1.12-7.el6cf.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
katello-cli-common-1.1.8-4.el6cf.noarch
candlepin-0.7.8-1.el6cf.noarch
qpid-cpp-client-ssl-0.14-14.el6_2.x86_64
katello-configure-1.1.9-3.el6cf.noarch
katello-glue-candlepin-1.1.12-7.el6cf.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
candlepin-tomcat6-0.7.8-1.el6cf.noarch
pulp-common-1.1.12-1.el6cf.noarch
qpid-cpp-server-0.14-14.el6_2.x86_64
katello-selinux-1.1.1-1.el6cf.noarch
katello-all-1.1.12-7.el6cf.noarch
python-qpid-0.14-7.el6_2.noarch
python-isodate-0.4.4-4.pulp.el6.noarch
qpid-cpp-client-0.14-14.el6_2.x86_64
pulp-1.1.12-1.el6cf.noarch
katello-common-1.1.12-7.el6cf.noarch
katello-1.1.12-7.el6cf.noarch
katello-qpid-client-key-pair-1.0-1.noarch
m2crypto-0.21.1.pulp-7.el6.x86_64
python-oauth2-1.5.170-2.pulp.el6.noarch
mod_wsgi-3.3-3.pulp.el6.x86_64

The problem was fixed only for one case, when system group name is wrong in add_system_group "activation_key add_system_group --name $correctname --system_group $wrongname --org ACME_Corporation".

But in 3 other cases it still fails:

1. Activation key name is wrong while adding: "activation_key add_system_group --name $wrongname --system_group $systemgroupname --org ACME_Corporation".
2. Activation key name is wrong while removing: "activation_key remove_system_group --name $wrongname --system_group $systemgroupname --org ACME_Corporation".
3. System group name is wrong while removing: "activation_key remove_system_group --name $name --system_group $wrongsystemgroupname --org ACME_Corporation".

In all 3 cases it shows error "error: list index out of range (more in the log file /var/log/katello/client.log)".

Comment 6 Miroslav Suchý 2012-09-19 14:52:25 UTC
https://github.com/Katello/katello/pull/708

Comment 7 Ivan Necas 2012-09-21 11:55:16 UTC
The request not merged yet, changing to ASSIGNED

Comment 10 Hayk Hovsepyan 2012-10-01 14:46:47 UTC
Verified on revision:
katello-certs-tools-1.1.8-1.el6cf.noarch
katello-common-1.1.12-9.el6cf.noarch
katello-1.1.12-9.el6cf.noarch
katello-qpid-client-key-pair-1.0-1.noarch
katello-configure-1.1.9-4.el6cf.noarch
katello-selinux-1.1.1-1.el6cf.noarch
katello-glue-candlepin-1.1.12-9.el6cf.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
katello-agent-1.1.2-1.el6cf.noarch
katello-glue-pulp-1.1.12-9.el6cf.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-cli-common-1.1.8-5.el6cf.noarch
katello-cli-1.1.8-5.el6cf.noarch

Now it works OK for all 4 cases.

Comment 12 errata-xmlrpc 2012-12-04 19:53:08 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


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