rdrgmnzs / pulp_centos_errata_import

Imports CentOS (from http://cefs.steve-meier.de/) errata into Pulp / Katello
61 stars 22 forks source link

Problem with importing errata into multiple repositories at once #13

Open petr22 opened 8 years ago

petr22 commented 8 years ago

Hello,

If you try to import errata into 2 or more repositories at once and there is some erratum, which should be added into both(or more) of those repositories, that erratum will be added only into one of them. And in katello it will only associate with that one repository and its hosts.

For example if you try to import errata into "centos6 updates" and "centos7 updates" repositories. Erratum CESA-2016:1504 should be added to both but it is uploaded only into one of them.

As a workaround I run the script separately for each repository(using --include-repo). That way it works fine. (btw in katello 3.0 you have to update pulp 2.8.4 => 2.8.6, because there is a bug in 2.8.4, that you cannot upload errata with same id even if they are in different repositories)

Anyway thanks for the great script.

eduardohki commented 8 years ago

Hi @petr22,

I'm having the same issue here, and I can confirm that the same erratum will be added only into one of them.

How did you upgrade Pulp to 2.8.6? When you upgraded, the problem was solved even without the workaround?

petr22 commented 8 years ago

Hi @eduardohki ,

the workaround doesnt work if you dont update pulp to 2.8.6.

To upgrade pulp to 2.8.6 you need to install this repo https://repos.fedorapeople.org/repos/pulp/pulp/rhel-pulp.repo . And change baseurl in [pulp-2-stable] to https://repos.fedorapeople.org/repos/pulp/pulp/stable/2.8/$releasever/$basearch/ . Then you do "yum --disablerepo=* --enablerepo=pulp-2-stable upgrade" . After that you can delete rhel-pulp.repo or disable pulp-2-stable repository.

petr22 commented 8 years ago

Sorry I forgot to mention other steps. The last post was only step 2 :).

1) systemctl stop httpd pulp_workers pulp_resource_manager pulp_celerybeat 2) yum --disablerepo=* --enablerepo=pulp-2-stable upgrade 3) sudo -u apache pulp-manage-db 4) systemctl start httpd pulp_workers pulp_resource_manager pulp_celerybeat

eduardohki commented 8 years ago

Thanks @petr22

Shouldn't we fire a bug in katello's redmine asking to upgrade katello's pulp repo to latest 2.8?

petr22 commented 8 years ago

Before updating I asked them on irc #theforeman if its ok to upgrade to 2.8.6 . Someone answered that they already tested 2.8.6 so its fine to upgrade and it will be in the next version of katello (3.1 for sure, 3.0.x maybe).

eduardohki commented 8 years ago

@petr22, thanks for the info.

pressplay21 commented 7 years ago

@petr22 How's the import experience going for you so far? @brdude if I use Steve's script with Spacewalk and sync the repos from Spacewalk to Pulp, would errata follow?

ubermevans commented 7 years ago

This seems to be happening currently. I'm using organizations with Foreman 1.14.1 and pulp 2.10.3, and since products can't be provided across orgs, I have to create a repo for the same content per org.

The net result is there are two repos (named differently) with basically the exact same content (synced from the same source).

The importer seems to ignore the second one completely, but if I get the repo ID from pulp-admin repo list (not the name and not the numerical ID), and run the importer against that repo with --include-repo=, it seems to work, though it has to start over from the beginning.

eduardohki commented 7 years ago

Hello @ubermevans,

I think this is a "pulp-admin" issue, so I suggest you to include the specific repo id into the command-line options, like the hint in "sample_wrapper_script.sh":

pulp-admin repo list --fields id | awk '/CentOS/ { print "--include-repo="$NF }' | xargs /sbin/errata_import.pl --errata=/tmp/errata.latest.xml --rhsa-oval=/tmp/com.redhat.rhsa-all.xml

Maybe is a good idea to refer to this problem directly into README :)

rdrgmnzs commented 7 years ago

What does everyone think of making the --include-repo= flag required, this would force users to specify their repo and would make sure users do not hit this issue.

eduardohki commented 7 years ago

I think it is a good idea, but would make the first setup harder, and more effort to maintain.

Why not embed this into the main script itself? Running the "pulp-admin repo list" inside the script before importing?

rdrgmnzs commented 7 years ago

The only reason I see as to not add "pulp-admin repo list" inside the script would be a case where there are repos you don't want to add erratum to. There is also the issue where you may maintain a repo with internally built packages and having those repos be auto included by the script would make the run longer by checking against a repo you would never have any erratas for.

eduardohki commented 7 years ago

Sorry, I completely forgot this "small" detail xD

ubermevans commented 7 years ago

So.. I am looking at the script itself, and it DOES do a pulp-admin repo list.. the appropriate bit of code:

&info("Getting``** server inventory\n");

if(!@repolist) { &debug("Getting full repo list\n"); @repolist = pulp-admin $pulp_args repo list -s | awk '{print \$1}'; } else { &debug("Using repo list from command line options: ".join(', ',@repolist)."\n"); }

My initial issue was not that it doesn't iterate through the repos.. it was that if one repo looked like another for some reason it will skip it completely. This may be something to do with how katello/pulp stores common packages (though it shouldn't).