Bug 845995 - CLI: wrong error when activation key name or system group name is wrong.
CLI: wrong error when activation key name or system group name is wrong.
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API (Show other bugs)
6.0.0
Unspecified Unspecified
unspecified Severity unspecified (vote)
: Unspecified
: --
Assigned To: Miroslav Suchý
Hayk Hovsepyan
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-06 08:35 EDT by Hayk Hovsepyan
Modified: 2014-09-18 11:32 EDT (History)
8 users (show)

See Also:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-04 14:53:08 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hayk Hovsepyan 2012-08-06 08:35:17 EDT
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 08:40:07 EDT
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 14:23:44 EDT
https://github.com/Katello/katello/pull/504
Comment 3 Miroslav Suchý 2012-08-26 13:46:36 EDT
Syntax error fixed in:
https://github.com/Katello/katello/pull/515
Comment 5 Hayk Hovsepyan 2012-09-18 08:58:25 EDT
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 10:52:25 EDT
https://github.com/Katello/katello/pull/708
Comment 7 Ivan Necas 2012-09-21 07:55:16 EDT
The request not merged yet, changing to ASSIGNED
Comment 10 Hayk Hovsepyan 2012-10-01 10:46:47 EDT
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 14:53:08 EST
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.