Description of problem: During importing manifests, the time validation should be done against last imported manifest's creating time, but not the last importing time. Version-Release number of selected component (if applicable): katello-headpin-all-0.1.135-2.el6.noarch katello-cli-headpin-0.1.15-2.el6.noarch thumbslug-0.0.21-1.el6.noarch candlepin-0.5.18-1.el6.noarch How reproducible: always Steps to Reproduce: 1.Prepare three manifests which were exported from the same distributor in order :1) manifest1 2) manifest2 3) manifest3 2.Import manifest1 to SAM. # headpin -u admin -p admin provider import_manifest --org=org1 --name="Red Hat" --file=manifest1.zip Manifest imported 3.Import manifest2 to SAM. # headpin -u admin -p admin provider import_manifest --org=org1 --name="Red Hat" --file=manifest2.zip Manifest imported 4.Import manifest3 to SAM. # headpin -u admin -p admin provider import_manifest --org=org1 --name="Red Hat" --file=manifest3.zip Actual results: Importing manifest, please wait... Manifest import for provider [ Red Hat ] failed, Candlepin::Owner: 409 Conflict {"displayMessage":"Import is older than existing data"} (POST /candlepin/owners/org_test/imports) Expected results: As manifest3 is newer than existing one(manifest2), it should be imported successfully. Additional info: 1.metadata of these manifests: 1)manifest1 {"version":"0.0.0","created":"2011-12-13T13:39:18.111+0000"} 2)manifest2 {"version":"0.5.5-1","created":"2012-01-09T02:45:23.545+0000"} 3)manifest3 {"version":"0.5.5-1","created":"2012-01-12T02:14:21.037+0000"} 2.related candlepin code candlepin/sync/Importer.java public void validateMetadata(String type, Owner owner, File meta, boolean force) throws IOException, ImporterException { ...... if (lastrun == null) { // this is our first import, let's create a new entry lastrun = new ExporterMetadata(type, m.getCreated(), owner); lastrun = expMetaCurator.create(lastrun); } else { if (!force && lastrun.getExported().compareTo(m.getCreated()) >= 0){ throw new ConflictException(i18n.tr("Import is older than existing data")); } else { lastrun.setExported(new Date()); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^shoud be set to creating time of the imported manifest expMetaCurator.merge(lastrun); } } }
d20b731 master 0.5.22+ Yu, Thanks for the detailed bug report.
Eric, There is a rule in candlepin that prevents a user who imported a manifest from one upstream consumer to re-import with a different upstream consumer. It looks like manifest1 was created with upstream consumer 81a76f13-d6f3-446a-a7f3-383d4c69b263, but manifest2 was created with 0a152131-7be9-4876-8247-e38113fd9b74. If you create two imports from the same upstream consumer, does that work?