Bug 190602 - rhnpush errors for --list option when run without --channel option
rhnpush errors for --list option when run without --channel option
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Other (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Pradeep Kilambi
wes hayutin
:
Depends On:
Blocks: 166615
  Show dependency treegraph
 
Reported: 2006-05-03 16:36 EDT by Pradeep Kilambi
Modified: 2009-03-24 12:44 EDT (History)
1 user (show)

See Also:
Fixed In Version: rhn500h
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-03-24 12:44:49 EDT
Type: ---
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 Pradeep Kilambi 2006-05-03 16:36:38 EDT
Description of problem:
rhnpush errors of with the following error message when we try to use --list
option without the channel label. Although it is doing the right thing by
throwing an error its making an unnecessary xml-rpc call to check for listing
the channels even though the channel label is not specified.

How reproducible: Always for --list without --channel

Steps to Reproduce:

[root@rlx-2-08 ~]# rhnpush --verbose --list --username=admin --password=dog8code
--server=http://rlx-2-08.rhndev.redhat.com Connecting to
http://rlx-2-08.rhndev.redhat.com/APP
Error Message:
     You are not allowed to manage channel , or that channel does not exist
 Error Class Code: 32
 Error Class Info: Channel error
 Explanation:
      An error has occurred while processing your request. If this problem
      persists please enter a bug report at bugzilla.redhat.com.
      If you choose to submit the bug report, please be sure to include
      details of what you were trying to do when this error occurred and
      details on how to reproduce this problem.
Version-Release number of selected component (if applicable):

Possible Solution:

if --list is specified --channel should be made a mandatory option and should
not processed to the rpc call unless both --list annd --channel options are
given.This way we can avoid unnecessary calls if required inputs are not given.
Comment 1 Bret McMillan 2006-09-05 13:57:20 EDT
yeah, the opt-parsing on that seems quite screwed up.  moving to rhn420-must
Comment 2 Pradeep Kilambi 2006-09-06 16:19:08 EDT
when a channel option is specified rhnpush_confmanager creates the
options.channel with something like this:
self.defaultconfig.channel = map(string.strip,
string.split(self.defaultconfig.channel, ','))

that is if --channel=A,B we get ['A', 'B'] but if no channel option is specified
we get ['']. which is a list of size 1. hence the check 
"if not options.channel" fails and thinks that there is a channel even though
there is not and continues the call to the server.

This is true for --newest flag a well. 
   [root@prad pkilambi]# rhnpush --server=rlx-0-20.rhndev.redhat.com
--username=admin --password=dog8code --newest

Error Message:
    You are not allowed to manage channel , or that channel does not exist
Error Class Code: 32
Error Class Info: Channel error
Explanation:
     An error has occurred while processing your request. If this problem
     persists please enter a bug report at bugzilla.redhat.com.
     If you choose to submit the bug report, please be sure to include
     details of what you were trying to do when this error occurred and
     details on how to reproduce this problem.

where --channel is mandatory for --newest. There is a check for the channel
option but it fails due to the way we return the empty channel list of size 1.

fix is to assign a null array to the option.channel when no --channel is specified.
if not self.defaultconfig.channel:
            #if no channel then make it null array instead of
            #an empty string array from of size 1 [''] .
            self.defaultconfig.channel = []
        else:
            self.defaultconfig.channel = map(string.strip,
string.split(self.defaultconfig.channel, ','))
        
That way it behaves as expected:

[pkilambi@prad pkilambi]# rhnpush --server=rlx-0-20.rhndev.redhat.com
--username=admin --password=dog8code --list
Must specify a channel for --list to list channels

[pkilambi@prad pkilambi]# rhnpush --server=rlx-0-20.rhndev.redhat.com
--username=admin --password=dog8code --newest

Must specify a channel for --newest to work

Comment 3 wes hayutin 2007-01-26 12:45:24 EST
the errors for the above look good..
however I'm not sure about the following...

[root@whayutin ~]#  PYTHONPATH='/usr/share/rhn' python /usr/bin/rhnpush
--server=fjs-0.06.rhndev.redhat.com --username=whayutin --password=redhat 
--newest -crhel-i386-es-4

ERROR: unhandled exception occurred: ((-2, 'Name or service not known')).
[root@whayutin ~]#  PYTHONPATH='/usr/share/rhn' python /usr/bin/rhnpush
--server=fjs-0.06.rhndev.redhat.com --username=whayutin --password=redhat 
--list -crhel-i386-es-4

ERROR: unhandled exception occurred: ((-2, 'Name or service not known')).

[root@whayutin ~]# rpm -qa | grep rhnpush
rhnpush-5.0.0-3

Comment 4 Pradeep Kilambi 2007-01-26 14:56:52 EST
yep we need a better error message here, although the problem here is your
server name is unresolvable, try fjs-0-06 instead of fjs-0.06
Comment 5 wes hayutin 2007-01-29 14:45:47 EST
oh man... thanks..
Ok.. got this working..

[whayutin@whayutin tmp]$ PYTHONPATH='/usr/share/rhn' python /usr/bin/rhnpush
--server=fjs-0-06.rhndev.redhat.com --username=whayutin --password=redhat 
-cwesleyd VMware-console-3.1.0-9089.i386.rpm --nosig

the above problem w/ the error is fixed.. closing the bug...
I'll open a new bug to track "Name or service not known" error message so its
more clear... low priority I'm sure..

thanks
Comment 6 wes hayutin 2007-03-09 22:03:52 EST
need a working satellite in stage to verify this.. but we're having cert problems.
Comment 7 Brandon Perkins 2007-03-13 10:18:58 EDT
Closed in rhn500h Release.
Comment 8 Brandon Perkins 2007-03-13 13:55:43 EDT
Closed in rhn500h release.
Comment 9 Brandon Perkins 2007-03-13 16:38:44 EDT
Closed in rhn500h Release.
Comment 10 Brandon Perkins 2007-03-13 16:55:32 EDT
Closed in rhn500h Release.

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