nicolas-r / katello-centos-errata-import

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

error: repository doesn't exists in Katello/Satellite #1

Closed pescobar closed 6 years ago

pescobar commented 6 years ago

I am trying to import errata in Foreman 1.16/Katello 3.5. I can correctly insert the errata in redis but when I try to insert it to Katello I get this error:

python centos-errata-katello-importer.py 
INFO :: Number of errata loaded from Redis 5626
Check that all specified repositories in config file really exist in Katello...
Starting new HTTPS connection (1): mykatello.com
https://mykatello:443 "GET /katello/api/v2/repositories HTTP/1.1" 200 1272
base_x86_64_centos_7.4 doesn't exits in Katello/Satellite

This is some of the data I get when accessing /katello/api/v2/repositories

1 |  
-- | --
content_type | "yum"
url | "http://mirror.switch.ch/ftp/mirror/centos/7.4.1708/os/x86_64/"
relative_path | "Default_Organization/Library/custom/Centos_7_4/base_x86_64_centos_7_4"
arch | "noarch"
backend_identifier | "45917054-6fe5-4466-abbb-873d4bc74131"
id | 18
name | "base_x86_64_centos_7.4"
label | "base_x86_64_centos_7_4"
product |  
id | 3
cp_id | "347125122932"
name | "Centos_7.4"
sync_plan |  
0 | "name"
1 | "description"
2 | "sync_date"
3 | "interval"
4 | "next_sync"
last_sync |  
id | "4d17f1ab-6d9a-4b79-9676-344b44d5f2eb"
username | "admin"
started_at | "2018-01-12 15:03:17 +0100"
ended_at | "2018-01-12 15:09:24 +0100"
state | "stopped"
result | "success"
progress | 1
content_counts |  
ostree_branch | 0
docker_manifest | 0
docker_tag | 0
rpm | 9591
package | 9591
package_group | 84
erratum | 0
puppet_module | 0
file | 0
last_sync_words | "6 minutes"

And this is the repositories section in my config file config.yaml for the script

repositories:
    base_x86_64_centos_7.4:
        pulp_id: 45917054-6fe5-4466-abbb-873d4bc74131
        os_release: 7

I tried to add a print kat_repo here https://github.com/nicolas-r/katello-centos-errata-import/blob/master/centos-errata-katello-importer.py#L78 and I verified that the script query the katello api correctly.

Am I doing something wrong in the config file or is this a bug in the script?

Thanks.

pescobar commented 6 years ago

ups, I just found the stupid mistake I was doing. I was using the repository name instead of the repository label, which only differ in a dot and an underscore. when reading it I hadn't notice they are different.

name | "base_x86_64_centos_7.4" vs label | "base_x86_64_centos_7_4"

Using this config with the label works fine:

repositories:
    base_x86_64_centos_7_4:
        pulp_id: 45917054-6fe5-4466-abbb-873d4bc74131
        os_release: 7