Bug 824583 - spacewalk-clone-by-date fails with traceback.
spacewalk-clone-by-date fails with traceback.
Status: CLOSED CURRENTRELEASE
Product: Spacewalk
Classification: Community
Component: Clients (Show other bugs)
1.8
Unspecified Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Stephen Herr
Red Hat Satellite QA List
:
Depends On: 817410
Blocks: space18
  Show dependency treegraph
 
Reported: 2012-05-23 15:12 EDT by Stephen Herr
Modified: 2012-11-01 12:20 EDT (History)
2 users (show)

See Also:
Fixed In Version: spacewalk-utils-1.8.16-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 817410
Environment:
Last Closed: 2012-11-01 12:20:04 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)

  None (edit)
Description Stephen Herr 2012-05-23 15:12:37 EDT
+++ This bug was initially created as a clone of Bug #817410 +++

Description of problem:

 spacewalk-clone-by-date fails and generates a traceback when executed to Sat550 with PostgreSQL.
 The problem is not presented on Sat 550 with Oracle.

Version-Release number of selected component (if applicable):
Sat 550 with PostgreSQL.

How reproducible:
100%

Steps to Reproduce:
1. Create a Custom channel with Child channel
2. Create  100 RPM packages (50 base + 50 updates)
3. Push the packages to the Custom channel.
4. Create 50 Errata from the update packages in the Custom channel.
5. Create  100 RPM packages (50 base + 50 updates)
6. Push the packages to the Chiled channel.
7. Create 50 Errata from the update packages in the Custom channel.
8. Execute:
spacewalk-clone-by-date --assumeyes --channel=chann_1 clone-chann_1 --channel=child_chann_1 child_chann_1 --username admin --password admin --to_date=2007-03-06 --blacklist='test-regular-1_chann_1,test-regular-1_child_chann_1' --removelist='test-regular-0_chann_1,test-regular-0_child_chann_1'
  
Actual results:

Copying repodata, please wait.
Solving Dependencies (100): 
________________________________________
######################################## - complete
Processing Dependencies:
________________________________________
######################################## - complete
Traceback (most recent call last):
  File "/usr/bin/spacewalk-clone-by-date", line 205, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/bin/spacewalk-clone-by-date", line 195, in main
    return cloneByDate.main(args)
  File "/usr/share/rhn/utils/cloneByDate.py", line 158, in main
    tree_cloner.prepare()
  File "/usr/share/rhn/utils/cloneByDate.py", line 297, in prepare
    cloner.prepare()            
  File "/usr/share/rhn/utils/cloneByDate.py", line 422, in prepare
    self.errata_to_clone, self.available_errata = self.get_errata()     
  File "/usr/share/rhn/utils/cloneByDate.py", line 506, in get_errata
    if err['issue_date'] <= self.to_date:
TypeError: can't compare offset-naive and offset-aware datetimes

Expected results:
PASS.

Additional info:
Comment 1 Stephen Herr 2012-05-23 15:25:24 EDT
Committed to spacewalk-master: 7e066ddf8b08acc67f2f0eab80545edf600ed728

This error occures only on Postgres because Postgres returns a datetime object with timezone info, whereas Oracle does not. The tool then compares the date with a datetime that does not have timezone info, which is illegal. 

The fix is simply to compare date objects instead of datetime objects. This is safe becuase errata release timestamps are dates anyway, there is no time info associated with them.
Comment 2 Jan Pazdziora 2012-10-30 15:24:42 EDT
Moving ON_QA. Packages that address this bugzilla should now be available in yum repos at http://yum.spacewalkproject.org/nightly/
Comment 3 Jan Pazdziora 2012-11-01 12:20:04 EDT
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18

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