Bug 1092594
Summary: | subscription-manager status --ondate=2000-01-01 is throwing wrong error message | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 5 | Reporter: | John Sefler <jsefler> |
Component: | subscription-manager | Assignee: | Bryan Kearney <bkearney> |
Status: | CLOSED ERRATA | QA Contact: | John Sefler <jsefler> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 5.11 | CC: | alikins, bkearney, fsharath |
Target Milestone: | rc | Keywords: | Regression |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2014-09-16 00:22:44 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: | 1039651 |
Description
John Sefler
2014-04-29 14:14:10 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux release for currently deployed products. This request is not yet committed for inclusion in a release. The python 2.4 sys.exit/Exception this seems to be in play here. if self.options.on_date: try: # doing it this ugly way for pre python 2.5 on_date = datetime.datetime( *(strptime(self.options.on_date, '%Y-%m-%d')[0:6])) if on_date.date() < datetime.datetime.now().date(): print (_("Past dates are not allowed")) sys.exit(1) self.sorter = ComplianceManager(on_date) except Exception: print(_("Date entered is invalid. Date should be in YYYY-MM-DD format (example: ") + strftime("%Y-%> sys.exit(1) The first system.exit() raise SystemExit, which the "except Exception" will catch it, show the "Date entered is invalid. Date should be..." error, and sys.exit again. Could either check exception type is not SystemExit in the handler, or change to avoid the earlier sys.exit(). Or figure out a more specific exceptions to catch in stead of "Exception". except StandardError instead of except Exception would probably work commit 4a716dfe6997846afb8769cb99343c6054a917b5 Author: Carter Kozak <ckozak> Date: Tue Apr 29 10:42:14 2014 -0400 1092594: don't catch SystemExit for past dates in "status --ondate=x" Version: # subscription-manager version server type: Red Hat Subscription Management subscription management server: 0.9.12-1 subscription-manager: 1.11.3-3.el5 python-rhsm: 1.11.3-3.el5 Verfication: Past Date: # subscription-manager status --ondate=2008-02-29 Past dates are not allowed Present date: # subscription-manager status --ondate=2014-05-21 +-------------------------------------------+ System Status Details +-------------------------------------------+ Overall Status: Current Future Date: # subscription-manager status --ondate=2016-02-29 +-------------------------------------------+ System Status Details +-------------------------------------------+ Overall Status: Current Invalid Dates: # subscription-manager status --ondate=2017-04-31 Date entered is invalid. Date should be in YYYY-MM-DD format (example: 2014-05-21 ) # subscription-manager status --ondate=2017-02-29 Date entered is invalid. Date should be in YYYY-MM-DD format (example: 2014-05-21 ) VERIFIED 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-2014-1225.html |