Bug 812803

Summary: rhn-satellite-exporter --start-date and --end-date specification does not export all relevant errata packages
Product: [Community] Spacewalk Reporter: Miroslav Suchý <msuchy>
Component: ServerAssignee: Miroslav Suchý <msuchy>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: high    
Version: 1.8CC: cperry, jpazdziora, mmello, pneedle, pstudeni, xdmoon
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: spacewalk-backend-1.8.17-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 805582 Environment:
Last Closed: 2012-11-01 16:17:24 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: 805582, 834378, 871344    

Description Miroslav Suchý 2012-04-16 09:34:12 UTC
+++ This bug was initially created as a clone of Bug #805582 +++

Description of problem:

rhn-satellite-exporter --start-date and --end-date specification does not export all relevant errata packages. This is the case in examples where seem to fit within the specified date range. If the date specification is then widened or no date is specified, the packages are exported.


Version-Release number of selected component (if applicable): Satellite 5.4.1.


How reproducible: Every time.


Steps to Reproduce:

To reproduce, I issued the following export command and output into a fresh dump location:

---
[root@vm-86 sattemp]# rhn-satellite-exporter --dir=/mnt/sattemp/00584335_dump_dated -c rhel-i386-server-6 --no-kickstarts --start-date=20111201000000 --end-date=20120101000000 
start date limit: 20111201000000
end date limit: 20120101000000
<etc>
Exporting: #################### - Done!
---

Searching for the packages detailed in my previous update on 17/02/2012 at 14:19 UK time, we can see that the expected files associated with, for example, 'rhn-erratum-8566.xml.gz' (RHEA-2011:1653-2) are not there. Expected packages are rhn-package-66553.xml.gz, rhn-package-66553.rpm, rhn-package-66553.xml.gz:

---
[root@vm-86 tmp]# for i in 66553 66784 66953 67661 67826 68051; do find /mnt/sattemp/00584335_dump_dated/ -iname rhn-package-$i* -exec ls -al {} \;;done
[root@vm-86 tmp]# 
---

I then cleared the dump directory and tried extending the date range:

---
[root@vm-86 tmp]# rhn-satellite-exporter --dir=/mnt/sattemp/00584335_dump_dated -c rhel-i386-server-6 --no-kickstarts --start-date=20111001000000 --end-date=20120228000000
start date limit: 20111001000000
end date limit: 20120228000000
<etc>
Exporting: #################### - Done!
---

Searching the resultant dump once again for the previously missing packages shows now that the files have successfully appeared:

---
[root@vm-86 tmp]# for i in 66553 66784 66953 67661 67826 68051; do find /mnt/sattemp/00584335_dump_dated/ -iname rhn-package-$i* -exec ls -al {} \;;done
-rw-r--r-- 1 root root 303852 Feb 28 15:10 /mnt/sattemp/00584335_dump_dated/rpms/53/rhn-package-66553.rpm
-rw-r--r-- 1 root root 366 Feb 28 15:10 /mnt/sattemp/00584335_dump_dated/packages_short/53/rhn-package-66553.xml.gz
-rw-r--r-- 1 root root 1784 Feb 28 15:11 /mnt/sattemp/00584335_dump_dated/packages/53/rhn-package-66553.xml.gz
---

That particular errata (RHEA-2011:1653-2) shows on RHN Hosted with an 'issued' date and an 'updated' date of 12/6/11 within the errata's page on the web GUI. On our first Satellite (the one sync'd with Hosted) the package shows the same 'issued' and 'updated' date. Within RHNERRATA table in the database, that package shows the following date field values:

---
SQL> select ADVISORY, ID, ISSUE_DATE, UPDATE_DATE, CREATED,  MODIFIED, LAST_MODIFIED from RHNERRATA where ADVISORY like '%RHEA-2011:1653%';

ADVISORY			ID 	ISSUE_DAT 	UPDATE_DA 	CREATED  	MODIFIED  	LAST_MODI
--------                        ------  ---------       ---------       -------         --------        --------- 
RHEA-2011:1653-2		8566 	06-DEC-11 	06-DEC-11 	01-JAN-12  	01-JAN-12 	06-DEC-11
---

The following options are detailed within 'rhn-satellite-exporter --help' output (but not in the rhn-satellite-exporter man page): 

---
  --use-rhn-date        Limit exported packages according to the date when
                        they appeared at Red Hat Network.
  --use-sync-date       Limit exported packages according to the date they
                        where pulled into satellite.
---

Even if I specify the command to use the RHN date (which I previously linked to ISSUE_DATE and then define the date range from 5th to 7th December, the packages do not appear. The command syntax I used was: 

---
[root@vm-86 tmp]# rhn-satellite-exporter --dir=/mnt/sattemp/00584335_dump_dated -c rhel-i386-server-6 --no-kickstarts --use-rhn-date --start-date=20111205000000 --end-date=20111207000000
---

Have we positively identified a bug in the date specification of the rhn-satellite-exporter command, or, are we using the wrong format/syntax in these examples? 

  
Actual results:
Packages are not exported when seemingly inclusive of the specified date range.

Expected results:
Relevant packages to be included in the export.

Comment 1 Miroslav Suchý 2012-04-16 09:35:52 UTC
Added new option --whole-errata: Always include package if it belongs to errata which is withing start/end-date range.

Done in spacewalk.git commits:
5846c25d3227ee2f69a934d620c4bd8387b1019f
951f7653be36d225237c6664ffc5654b48033d2b

Comment 5 Jan Pazdziora 2012-11-01 16:17:24 UTC
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18