Bug 994344

Summary: Display appropriate message when used unsupported files in rct cat-manifest/dump-manifest command
Product: Red Hat Enterprise Linux 6 Reporter: Rehana <redakkan>
Component: subscription-managerAssignee: Carter Kozak <ckozak>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.5CC: bkearney, ckozak, fsharath, jesusr, jgalipea, jmolet, jsefler, skallesh, spandey
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
No description necessary.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 21:27:20 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:
Bug Depends On:    
Bug Blocks: 862910    

Description Rehana 2013-08-07 05:42:16 UTC
Description of problem:
Observed that cat-manifest works with .zip files (which is correct as desgied), when given other files like .pem in rct cat-manifest command , its throwing Traceback.Logging a bug to catch the Traceback and display a good error message.


Version-Release number of selected component (if applicable):
rpm -qa | grep subs
subscription-manager-gui-1.9.0-1.git.67.5fdacc1.el6.x86_64
subscription-manager-debuginfo-1.8.14-1.el6_4.x86_64
subscription-manager-migration-data-1.12.2.6-1.git.0.171d4c3.el6.noarch
subscription-manager-firstboot-1.9.0-1.git.67.5fdacc1.el6.x86_64
subscription-manager-migration-1.9.0-1.git.67.5fdacc1.el6.x86_64
subscription-manager-1.9.0-1.git.67.5fdacc1.el6.x86_64

How reproducible:
3/3

Steps to Reproduce:
1.Execute rct cat-manifest with any file(ex:rct cm 2514643273829928242.pem)
2.Execute rct dump-manifest with any file(ex:rct dm 5467644249924152940.pem)
3.

Actual results:
observed the below traceback error
 
root@rehanatestmachine entitlement]# rct dm 5467644249924152940.pem 
Traceback (most recent call last):
  File "/usr/bin/rct", line 44, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/bin/rct", line 39, in main
    return RctCLI().main()
  File "/usr/share/rhsm/subscription_manager/cli.py", line 166, in main
    return cmd.main()
  File "/usr/share/rhsm/rct/commands.py", line 39, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/rct/manifest_commands.py", line 312, in _do_command
    if self._extract(os.getcwd(), self.options.overwrite_files):
  File "/usr/share/rhsm/rct/manifest_commands.py", line 289, in _extract
    self._extract_manifest(destination, overwrite)
  File "/usr/share/rhsm/rct/manifest_commands.py", line 141, in _extract_manifest
    archive = ZipExtractAll(self._get_file_from_args(), 'r')
  File "/usr/lib64/python2.6/zipfile.py", line 696, in __init__
    self._GetContents()
  File "/usr/lib64/python2.6/zipfile.py", line 716, in _GetContents
    self._RealGetContents()
  File "/usr/lib64/python2.6/zipfile.py", line 728, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file


Expected results:
Though the traceback is saying what the problem is, we suggest that it will be good to catch this traceback and display a user friendly message in the console

Additional info:

Comment 2 Carter Kozak 2013-08-28 16:49:40 UTC
commit dad138479c1e34151f29a04d8c1e202c5d0d67ba
Author: ckozak <ckozak>
Date:   Mon Aug 26 13:18:43 2013 -0400

    994344: messaging for bad filetypes

Comment 4 John Sefler 2013-09-15 18:37:35 UTC
Verifying Version...
[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.9.6-1.el6.x86_64

[root@jsefler-6 ~]# rct cat-manifest /etc/pki/product/69.pem 
Manifest zip is invalid.
[root@jsefler-6 ~]# rct dump-manifest /etc/pki/product/69.pem 
Manifest zip is invalid.

VERIFIED: The former Traceback is now caught and "Manifest zip is invalid." is now printed to stdout.

Comment 5 errata-xmlrpc 2013-11-21 21:27:20 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/RHBA-2013-1659.html