Bug 694735

Summary: rhn-satellite-exporter: incremental errata & ks tree export does not respect --use-rhn-date / --use-sync-date switches
Product: Red Hat Satellite 5 Reporter: Milan Zázrivec <mzazrivec>
Component: ServerAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED ERRATA QA Contact: Jan Hutař <jhutar>
Severity: medium Docs Contact:
Priority: high    
Version: 541CC: cperry, dyordano, jhutar, slukasik
Target Milestone: ---Keywords: EasyFix, Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-backend-1.2.13-52 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-17 02:42:44 UTC Type: ---
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: 677501    
Attachments:
Description Flags
patch
none
updated patch none

Description Milan Zázrivec 2011-04-08 07:46:26 UTC
Description of problem:
Channel information serialized into an XML file during channel export contains
errata information in two places:
1. /rhn-satellite/rhn-channels/rhn-channel/@channel-errata
2. /rhn-satellite/rhn-channels/rhn-channel/rhn-channel-errata/errata

While the first is being exported correctly (i.e the list of erratas
is exported either by rhnErrata.last_modified or rhnChannelErrata.modified;
based on what was specified on command line), the second list of erratas
is always being exported based on rhnChannelErrata.modified, regardless
of what was specified on command line.

This naturally poses a problem since:
1. List of the erratas falling into the two intervals will not always match
2. satellite-sync searches for the exported erratas based on the information
contained in the second list

A synchronization error occurs, when the second list contains an errata
which is not contained in the first list.

Version-Release number of selected component (if applicable):
spacewalk-backend-1.2.13-38

How reproducible:
Always

Steps to Reproduce:
1. Satellite 5.4, redhat-rhn-proxy-4.2-as-i386-4 synced
2. rm -rf /var/cache/rhn/xml-*;
3. rhn-satellite-exporter -c redhat-rhn-proxy-4.2-as-i386-4 \
   -d wherever --start-date 20090611000000 --end-date 20110407000000
4. cd wherever
5. xmllint -format channels/redhat-rhn-proxy-4.2-as-i386-4/channel.xml.gz
6. Check whether the erratas contained in the first and second list match
7. Make sure you're able to import the dump
  
Actual results:
The lists do not match, the sync fails with following error:

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 336, in _step_download_errata
    return self.syncer.download_errata()
  File "/usr/share/rhn/satellite_tools/satsync.py", line 1741, in download_errata
    stream_loader.process(chunk)
  File "/usr/share/rhn/satellite_tools/satsync.py", line 2100, in process
    stream = self.disk_loader.load()
  File "/usr/share/rhn/satellite_tools/xmlDiskSource.py", line 41, in load
    return self._loadFile(filename)
  File "/usr/share/rhn/satellite_tools/xmlDiskSource.py", line 59, in _loadFile
    raise MissingXmlDiskSourceFileError("unable to process file %s" % filename)
MissingXmlDiskSourceFileError: unable to process file /var/satellite/channel-dumper/dump-iso/errata/5/rhn-erratum-4835.xml

Expected results:
The lists match, it is possible to import the dump.

Additional info:
N/A

Comment 1 Milan Zázrivec 2011-04-08 07:47:38 UTC
Created attachment 490718 [details]
patch

Comment 4 Milan Zázrivec 2011-04-08 13:27:01 UTC
Created attachment 490793 [details]
updated patch

Updated patch: similar problem shows when exporting kickstartable trees.

Comment 5 Milan Zázrivec 2011-04-15 13:56:52 UTC
satellite.git SATELLITE-5.4: 8e703c1009d367efd607cf0093c81ef0b632b480

Comment 7 Milan Zázrivec 2011-04-18 09:50:48 UTC
One more fix -- export kickstart files based on kickstartable tree's
last_modified time stamp:

spacewalk.git master: c5bcfcc658c69df7005772c424dfb0f7cd82b365
satellite.git SATELLITE_5.4: 43b3f833ecc10eb15dab80140d5b8f5764242ec7

Comment 11 Milan Zázrivec 2011-05-20 10:07:35 UTC
Fix for the problem described in comment #10:

spacewalk.git master: c3cd0b7b7dee7275352ea8b148fd3843bd20106b
satellite.git SATELLITE-5.4: 74b7f3f9b2a2a074ddcf6cb9e0fe49260f1d72a2

Comment 14 Dimitar Yordanov 2011-06-13 11:05:59 UTC
Verified on Stage.
Moving to Release Pending

Comment 15 Clifford Perry 2011-06-17 02:42:44 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

https://rhn.redhat.com/errata/RHEA-2011-0875.html