nicolas-r / katello-centos-errata-import

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

Auto syncing after successfull import of Errata #3

Closed W73 closed 6 years ago

W73 commented 6 years ago

Not issue, but Enhancement. Would be possible to add something like

pulp-admin rpm repo sync run --repo-id=${pulp_id_from_config.yml}

after successfull import of errata to database ?

nicolas-r commented 6 years ago

Hi

Why not. I will see what I can do

nicolas-r commented 6 years ago

Hi

can you try the branch dev-repo-sync-after-import please ?

After the import, I trigger a sync of the repositories in the config.yaml file via the Katello API

W73 commented 6 years ago

I downloaded it, run process and did not see update in WebUI Sync Status. So i am not sure if syncing was started. I will check it in few days. I will not update it for a moment.

nicolas-r commented 6 years ago

Can you try the following procedure ?

  1. Sync your repositories from Katello and wait of them to finish
  2. Go to the directory with where you clone the repository
  3. Checkout the specific branch: git checkout dev-repo-sync-after-import
  4. Update it: git pull
  5. Update the data files : ./download-data.sh
  6. Load into redis new errata(s) if needed: ./centos-errata-redis-loader.py
  7. Import them into Katello: ./centos-errata-katello-importer.py

If everything goes well, you should see something like that at the end

2018-04-06 19:48:35,784 :: INFO :: 0 errata(s) added to repo_centos_7_extras_x86_64 2018-04-06 19:48:35,784 :: INFO :: Start the synchonization for repo_centos_7_extras_x86_64 2018-04-06 19:48:35,786 :: DEBUG :: Starting new HTTPS connection (1): centos-katello 2018-04-06 19:48:36,556 :: DEBUG :: https://centos-katello:443 "POST /katello/api/v2/repositories/3/sync HTTP/1.1" 202 None 2018-04-06 19:48:36,561 :: INFO :: Task id: 84886767-d6da-49e4-850f-cbb7b4f76639, started at: 2018-04-06 17:48:33 UTC, state: planned 2018-04-06 19:48:36,561 :: INFO :: 0 errata(s) added to repo_centos_7_updates_x86_64 2018-04-06 19:48:36,561 :: INFO :: Start the synchonization for repo_centos_7_updates_x86_64 2018-04-06 19:48:36,563 :: DEBUG :: Starting new HTTPS connection (1): centos-katello 2018-04-06 19:48:37,463 :: DEBUG :: https://centos-katello:443 "POST /katello/api/v2/repositories/2/sync HTTP/1.1" 202 None 2018-04-06 19:48:37,467 :: INFO :: Task id: 08482b5c-a7bb-4b89-87d2-44ad29db0b7c, started at: 2018-04-06 17:48:34 UTC, state: planned 2018-04-06 19:48:37,467 :: INFO :: 0 errata(s) added to repo_centos_7_x86_64 2018-04-06 19:48:37,467 :: INFO :: Start the synchonization for repo_centos_7_x86_64 2018-04-06 19:48:37,470 :: DEBUG :: Starting new HTTPS connection (1): centos-katello 2018-04-06 19:48:38,692 :: DEBUG :: https://centos-katello:443 "POST /katello/api/v2/repositories/1/sync HTTP/1.1" 202 None 2018-04-06 19:48:38,696 :: INFO :: Task id: 817f42f6-f99d-4d2d-a834-4ab237ce89c1, started at: 2018-04-06 17:48:35 UTC, state: planned

You will be able to see the tasks in Katello and the errata(s) number has changed

W73 commented 6 years ago

It may not be connected, but i received this error for first time. Although it worked smoothly earlier. No changes.

2018-04-09 11:58:12,037 :: INFO :: Start the synchonization for CentOS_6_-_Base_-_x86_64
2018-04-09 11:58:12,039 :: INFO :: Starting new HTTPS connection (1): server.lab
2018-04-09 11:58:12,197 :: DEBUG :: "POST /katello/api/v2/repositories/354/sync HTTP/1.1" 403 None
Traceback (most recent call last):
  File "./centos-errata-katello-importer.py", line 236, in <module>
    logger.info("Task id: %s, started at: %s, state: %s" % (res['id'], res['started_at'], res['state']))
KeyError: 'id'
W73 commented 6 years ago

Oh... Could not be problem, that i created service account for reading only from katello api, so this limited user does not have rights to post json to this api ? It makes sense, right ? :-)

Stupid me. <--Confirmed.

So this works as expected, i just forgot i created limited user for reading only.

nicolas-r commented 6 years ago

As we can see a 403 code in the previous stacktrace, I think you have found the root cause :)

Glad to hear this is working, I will merge the code to master and close this issue

Thanks for testing