Bug 822637 - rhua-manager cli needs to catch invalid data
rhua-manager cli needs to catch invalid data
Status: CLOSED ERRATA
Product: Red Hat Update Infrastructure for Cloud Providers
Classification: Red Hat
Component: RHUA (Show other bugs)
2.1
Unspecified Unspecified
high Severity unspecified
: ---
: ---
Assigned To: wes hayutin
Martin Kočí
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-17 12:49 EDT by wes hayutin
Modified: 2012-08-24 09:27 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
For #rhui-manager repo info, and #rhui-manager packages list, when invalid data is passed, ugly traceback is returned. Patches have been applied to render.py and packages.py so that when invalid data is passed, it only returns repo_id/repository not found.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-24 07:54:36 EDT
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)
patch to catch invalid repos provided via rhua-manager cli (2.22 KB, patch)
2012-05-17 13:27 EDT, wes hayutin
no flags Details | Diff
patch for a cleaner message to users when an invalid repo is passed (941 bytes, patch)
2012-05-17 14:07 EDT, wes hayutin
no flags Details | Diff

  None (edit)
Description wes hayutin 2012-05-17 12:49:52 EDT
Description of problem:

[whayutin@minidoe tools]$ PYTHONPATH=src/ bin/rhui-manager --config dev/rhui-tools.conf repo info --repo_id 3

rhui-manager throws an ugly exception if bogus data is passed via the command line

Traceback (most recent call last):
  File "bin/rhui-manager", line 16, in <module>
    rhui.tools.launcher.main()
  File "/home/whayutin/workspace/cloude/rhui-2.0/tools/src/rhui/tools/launcher.py", line 341, in main
    cli.run(args)
  File "/home/whayutin/workspace/cloude/rhui-2.0/tools/src/rhui/common/cli.py", line 277, in run
    command_or_section.execute(remaining_args)
  File "/home/whayutin/workspace/cloude/rhui-2.0/tools/src/rhui/common/cli.py", line 118, in execute
    self.method(**arg_dict)
  File "/home/whayutin/workspace/cloude/rhui-2.0/tools/src/rhui/tools/commands/repo.py", line 70, in info
    render.display_repo_details(self.prompt, repo)
  File "/home/whayutin/workspace/cloude/rhui-2.0/tools/src/rhui/tools/render.py", line 131, in display_repo_details
    if GROUP_RED_HAT in repo['groupid']:
TypeError: 'NoneType' object is not subscriptable
Comment 1 wes hayutin 2012-05-17 13:27:17 EDT
Created attachment 585279 [details]
patch to catch invalid repos provided via rhua-manager cli
Comment 2 wes hayutin 2012-05-17 14:07:32 EDT
Created attachment 585293 [details]
patch for a cleaner message to users when an invalid repo is passed
Comment 3 wes hayutin 2012-05-18 14:19:04 EDT
[whayutin@minidoe tools]$ PYTHONPATH=src/ bin/rhui-manager --config dev/rhui-tools.conf --debug repo info --repo_id 3
No repositories found


This appears to be working w/o changes
cloude commit 189483f24a6e6ddf6dabcac65b2f561ad550b11e
pulp commit e05ced383504133543ac7b6114b45c98699b6e61

moving to on_qa
Comment 4 wes hayutin 2012-05-18 14:28:12 EDT
cloude commit ede48cd639a19fef3666380eecbf46c7e95a80fd

fixed rhui-manager packages list --repo_id
Comment 5 Martin Kočí 2012-08-01 11:09:42 EDT
It seems fixes are not merged with the latest version: 
/root/RHEL-6.3-RHUI-2.1-20120731.0-Server-x86_64-DVD1.iso on /tmp/mnt type iso9660 (rw,loop=/dev/loop0)

[root@ip-10-85-5-60 usr]# PYTHONPATH=src/ bin/rhui-manager --config /etc/rhui/rhui-tools.conf repo info --repo_id 3
Traceback (most recent call last):
  File "bin/rhui-manager", line 16, in <module>
    rhui.tools.launcher.main()
  File "/usr/lib/python2.6/site-packages/rhui/tools/launcher.py", line 348, in main
    cli.run(args)
  File "/usr/lib/python2.6/site-packages/rhui/common/cli.py", line 272, in run
    command_or_section.execute(remaining_args)
  File "/usr/lib/python2.6/site-packages/rhui/common/cli.py", line 113, in execute
    self.method(**arg_dict)
  File "/usr/lib/python2.6/site-packages/rhui/tools/commands/repo.py", line 71, in info
    render.display_repo_details(self.prompt, repo)
  File "/usr/lib/python2.6/site-packages/rhui/tools/render.py", line 135, in display_repo_details
    if GROUP_RED_HAT in repo['groupid']:
TypeError: 'NoneType' object is unsubscriptable

Moving bug to ON_DEV
Comment 6 wes hayutin 2012-08-01 11:56:47 EDT
looks fine in the latest build..

here is a sample plan..


[root@ip-10-70-90-96 ~]# rhui-manager repo list --help
Usage: rhui-manager [options]

Options:
  -h, --help  show this help message and exit
list: lists all repositories in the RHUI
[root@ip-10-70-90-96 ~]# rhui-manager repo info
info: displays information on an individual repo
    --repo_id - identifies the repository to display (required)

The following options are required but were not specified:
    --repo_id
[root@ip-10-70-90-96 ~]# rhui-manager repo info --repo_id rhel-server-5-5Server-x86_64
Name:                Red Hat Enterprise Linux Server 5 (RPMs) (5Server-x86_64)
Type:                Red Hat
Relative Path:       content/dist/rhel/rhui/server/5/5Server/x86_64/os
Package Count:       13912
Last Sync:           08-01-2012 06:17
Next Sync:           08-01-2012 11:37
[root@ip-10-70-90-96 ~]# rhui-manager repo info --repo_id
Usage: rhui-manager [options]

info: displays information on an individual repo
    --repo_id - identifies the repository to display (required)
[root@ip-10-70-90-96 ~]#
Comment 7 wes hayutin 2012-08-01 13:00:30 EDT
b3895b0827e5d41d03ee0dcf97e1f50dade492c6
bf882b877d575825307dd21879319e22df045925

k.. this should be fixed for any use case in "repo" and "packages"

good catch
Comment 8 Martin Kočí 2012-08-02 07:52:29 EDT
VERIFIED against 
/root/RHEL-6.3-RHUI-2.1-20120801.0-Server-x86_64-DVD1.iso

[root@ip-10-46-39-253 ~]# rhui-manager repo info --repo_id doesntexist
repository doesntexist was not found
[root@ip-10-46-39-253 ~]# rhui-manager packages list --repo_id doesntexist
repo_id not found

Moving bug to VERIFIED
Comment 9 Julie 2012-08-15 16:09:39 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
For #rhui-manager repo info, and #rhui-manager packages list, when invalid data is passed, ugly traceback is returned. Patches have been applied to render.py and packages.py so that when invalid data is passed, it only returns repo_id/repository not found.
Comment 11 errata-xmlrpc 2012-08-24 07:54:36 EDT
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/RHEA-2012-1205.html

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