Bug 637155 - dump is generated with 20100920, sync expected 20100920000000
Summary: dump is generated with 20100920, sync expected 20100920000000
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Satellite Synchronization
Version: 540
Hardware: All
OS: Linux
urgent
medium
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Petr Sklenar
URL:
Whiteboard:
Depends On:
Blocks: sat540-blockers
TreeView+ depends on / blocked
 
Reported: 2010-09-24 13:49 UTC by Petr Sklenar
Modified: 2010-10-28 15:00 UTC (History)
4 users (show)

Fixed In Version: spacewalk-backend-1.2.13-8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-10-28 15:00:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Petr Sklenar 2010-09-24 13:49:09 UTC
Description of problem:
dump is generated with 20100920, sync expected 20100920000000

Version-Release number of selected component (if applicable):
Satellite-5.4.0-RHEL5-re20100921.0

How reproducible:
always

Steps to Reproduce:
1. create empty channel
2. rhn-satellite-exporter --channel your_channel --dir /tmp/your_channel/ -vvvvv --start-date 20100920  --print-report
3. satellite-sync -m /tmp/your_channel -l
  
Actual results:

# satellite-sync -m /tmp/your_channel -l
09:36:17 Red Hat Network Satellite - file-system synchronization
09:36:17    mp:  /tmp/your_channel
09:36:17    db:  rhnsat/<password>@rhnsat
09:36:17 
09:36:17 Retrieving / parsing channel-families data
09:36:17 channel-families data complete
09:36:17 
09:36:17 Retrieving / parsing channel data
09:36:17    p = previously imported/synced channel
09:36:17    . = channel not yet imported/synced
09:36:17    base-channels:
+++ sending log as an email +++

SYNC ERROR: unhandled exception occurred:

(Check logs/email for potentially more detail)
Message 17:
From rhn-satellite.bos.redhat.com  Fri Sep 24 09:36:17 2010
Date: Fri, 24 Sep 2010 09:36:17 -0400
From: rhn-satellite.bos.redhat.com
Subject: RHN Management Satellite sync. report from ibm-hs22-04.lab.bos.redhat.com
To: root.bos.redhat.com


=====
mail is
09:36:17 
SYNC ERROR: unhandled exception occurred:

Exception reported from XXXXXX.redhat.com
Time: Fri Sep 24 09:36:17 2010
Exception type exceptions.ValueError

Exception Handler Information
Traceback (most recent call last):
  File "/usr/bin/satellite-sync", line 143, in main
    return satsync.Runner().main()
  File "/usr/share/rhn/satellite_tools/satsync.py", line 226, in main
    ret = method()
  File "/usr/share/rhn/satellite_tools/satsync.py", line 301, in _step_channels
    self.syncer.process_channels()
  File "/usr/share/rhn/satellite_tools/satsync.py", line 690, in process_channels
    self._printChannelTree(doEOSYN=doEOSYN)
  File "/usr/share/rhn/satellite_tools/satsync.py", line 775, in _printChannelTree
    log(1, p_format % (status, plabel, pkgs_count, self._formatChannelExportType(channel_object)))
  File "/usr/share/rhn/satellite_tools/satsync.py", line 737, in _formatChannelExportType
    return _("%10s import from %s - %s") % (export_type, self._formatDateTime(start_date), self._formatDateTime(end_date))
  File "/usr/share/rhn/satellite_tools/satsync.py", line 718, in _formatDateTime
    return time.strftime (locale.nl_langinfo(locale.D_T_FMT), time.strptime(datestring, '%Y%m%d%H%M%S'))
  File "/usr/lib64/python2.4/_strptime.py", line 293, in strptime
    raise ValueError("time data did not match format:  data=%s  fmt=%s" %
ValueError: time data did not match format:  data=20100920  fmt=%Y%m%d%H%M%S

Aditional info:
this works with sat530

Comment 1 Miroslav Suchý 2010-09-24 14:08:03 UTC
Man page say:
       --start-date=START_DATE
              The  start date limit that the last modified dates are compared against. Must be in the format
              ’YYYYMMDDHH24MISS’.

So the fact that sat530- was able to create dump with only YYYYMMDD is bug and coincidence.
In fact as I looking at the code we did not check the format in code at all.
Only "check" is 
  ... where TO_Date(:start_date, 'YYYYMMDDHH24MISS') < ...
and this suceed even when date is in format of YYYYMMDD or YYYYMMDDHH24 of YYYYMMDDHH24MI.
So I suggest that if we get string with length < 14 we will pad from right with zeros. And mention this in man page.

Comment 2 Miroslav Suchý 2010-09-24 15:09:26 UTC
Commited as 537985d68fa417decfc1ced913bdc76b83b05c7b in spacewalk.git

Comment 4 Miroslav Suchý 2010-09-27 11:07:25 UTC
commited to satellite.git as commit e226bd4f0415aff8cc6009cd5d2f14868d87013a

Comment 6 Jan Pazdziora (Red Hat) 2010-09-29 07:36:03 UTC
Marking as fixed in spacewalk-backend-1.2.13-8.

Comment 8 Petr Sklenar 2010-10-04 15:37:52 UTC
[root@sat540 ~]# rhn-satellite-exporter -c parent-channel --channel child-channel-sha1  -c child-channel-sha256 -c child-channel-sha512 --dir /tmp/parent-channel -vvvvv --start-date 20100920  --end-date 20101020 --print-report
start date limit: 20100920000000
end date limit: 20101020000000
.
.
.
[root@sat540 ~]# satellite-sync -m /tmp/parent-channel -c parent-channel -c child-channel-sha256 -c child-channel-sha1 -c child-channel-sha512

[root@sat540 ~]# satellite-sync -m /tmp/parent-channel -l

--
verified with Satellite-5.4.0-RHEL5-re20101001.1

Comment 9 Michael Mráka 2010-10-20 14:30:41 UTC
Verified in stage.

[root@hp-bl685cg6-01 ~]# rhn-satellite-exporter -c rhel-x86_64-server-5 --channel  redhat-rhn-proxy-5.4-server-x86_64-5  -c  rhel-x86_64-server-6  -c rhn-tools-rhel-x86_64-server-6 --dir /tmp/satexport -vvvvv --start-date 20101001  --end-date 20101020 --print-report
start date limit: 20101001000000
end date limit: 20101020000000
...
[root@hp-bl685cg6-01 ~]# satellite-sync -m /tmp/satexport --list-channels
10:24:09 Red Hat Network Satellite - file-system synchronization
10:24:09    mp:  /tmp/satexport
10:24:09    db:  rhnsat/<password>@rhnsat
10:24:09 
10:24:09 Retrieving / parsing channel-families data
10:24:09 channel-families data complete
10:24:11 
10:24:11 Retrieving / parsing channel data
10:24:11    p = previously imported/synced channel
10:24:11    . = channel not yet imported/synced
10:24:11    base-channels:
10:24:11       p rhel-x86_64-server-5                     10104 incremental import from Fri Oct  1 00:00:00 2010 - Wed Oct 20 00:00:00 2010
10:24:11       p rhel-x86_64-server-6                        0 incremental import from Fri Oct  1 00:00:00 2010 - Wed Oct 20 00:00:00 2010
10:24:11    rhel-x86_64-server-5:
10:24:11       p redhat-rhn-proxy-5.4-server-x86_64-5       87 incremental import from Fri Oct  1 00:00:00 2010 - Wed Oct 20 00:00:00 2010
10:24:11    rhel-x86_64-server-6:
10:24:11       p rhn-tools-rhel-x86_64-server-6             20 incremental import from Fri Oct  1 00:00:00 2010 - Wed Oct 20 00:00:00 2010
10:24:11 
    Import complete:
        Begin time: Wed Oct 20 10:24:09 2010
        End time:   Wed Oct 20 10:24:11 2010
        Elapsed:    0 hours, 0 minutes, 1 seconds

Comment 10 Clifford Perry 2010-10-28 14:55:20 UTC
The 5.4.0 RHN Satellite and RHN Proxy release has occurred. This issue has been resolved with this release. 


RHEA-2010:0801 - RHN Satellite Server 5.4.0 Upgrade
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10332

RHEA-2010:0803 - RHN Tools enhancement update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10333

RHEA-2010:0802 - RHN Proxy Server 5.4.0 bug fix update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10334

RHEA-2010:0800 - RHN Satellite Server 5.4.0
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10335

Docs are available:

http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/index.html 

Regards,
Clifford


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