Description of problem: spacewalk-clone-by-date when specifying the parameter -d <YYYY-MM-DD> does not include errata signed on the date for the date parameter given For instance, if we run the command below: spacewalk-clone-by-date -y --user=mmello --password=xxxxxx -d 2012-08-20 --channel=rhel-x86_64-server-6 test-sfdc00676052, errata signed on 2012-08-20 will be not included on the cloned channel. Version-Release number of selected component (if applicable): spacewalk-utils-1.2.1-17.el6sat.src.rpm How reproducible: 100% Steps to Reproduce: 1. Run the command above and observe that errata signed on the same date will not be included Actual results: Errata is not included when signed on the same for the parameter -d Expected results: Include errata for the parameter given Additional info:
The issue is located in utils/CloneByDate.py ------------------ 500 def get_errata(self): 501 """ Returns tuple of all available for cloning, and what falls in the date range""" 502 available_errata = self.db_api.applicable_errata(self.from_label, self.to_label) 503 to_clone = [] 504 505 for err in available_errata: 506 if err['issue_date'] <= self.to_date: 507 to_clone.append(err) 508 509 return (to_clone, available_errata) As we can see, for every errata it check the issue_date <= self.to_date. Adding some debug marks we can see the errata RHBA-2012:1175 being excluded. Look the debugging code below: # diff -ruN /usr/share/rhn/utils/cloneByDate.py.bak /usr/share/rhn/utils/cloneByDate.py --- /usr/share/rhn/utils/cloneByDate.py.bak 2012-08-21 13:43:39.681541759 -0300 +++ /usr/share/rhn/utils/cloneByDate.py 2012-08-21 14:04:56.913077536 -0300 @@ -505,6 +505,11 @@ for err in available_errata: if err['issue_date'] <= self.to_date: to_clone.append(err) + else: + print "advisory_name --> %s" %(err['advisory_name']) + print "issue_date --> %s" %(err['issue_date']) + print "to_date --> %s" %(self.to_date) + return (to_clone, available_errata) Executing the command: # /usr/bin/spacewalk-clone-by-date -y --user=mmello --password=xxxxxxx -d 2012-08-20 --channel=rhel-x86_64-server-6 test-sfdc00676052-2012-08-20_3 2012-08-20 00:00:00 Reading repository information. By continuing the following channels will be created: test-sfdc00676052-2012-08-20_3 Cloning rhel-x86_64-server-6 to test-sfdc00676052-2012-08-20_3 with original package set. Copying repodata, please wait. Solving Dependencies (3429): ________________________________________ ######################################## - complete Processing Dependencies: ________________________________________ ######################################## - complete advisory_name --> RHBA-2012:1175 issue_date --> 2012-08-20 01:00:00 to_date --> 2012-08-20 00:00:00 advisory_name --> RHSA-2012:1180 issue_date --> 2012-08-20 01:00:00 to_date --> 2012-08-20 00:00:00
It seems that we already have a fix on upstream spacewalk.master $ git show 7e066ddf commit 7e066ddf8b08acc67f2f0eab80545edf600ed728 Author: Stephen Herr <sherr> Date: Wed May 23 15:17:07 2012 -0400 824583 - spacewalk-clone-by-date failes with TypeError when on Postgres database. The Postgres database returns a datetime object with a timezone, whereas oracle returnes one without. The tool then tries to comparte it with a datetime that has no timezone info, which is illegal. The fix i diff --git a/utils/cloneByDate.py b/utils/cloneByDate.py index f93e964..c4f0fe1 100644 --- a/utils/cloneByDate.py +++ b/utils/cloneByDate.py @@ -503,7 +503,7 @@ class ChannelCloner: to_clone = [] for err in available_errata: - if err['issue_date'] <= self.to_date: + if err['issue_date'].date() <= self.to_date.date(): to_clone.append(err) return (to_clone, available_errata)
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-2012-1408.html