upstream_sync icon indicating copy to clipboard operation
upstream_sync copied to clipboard

Feature request: SuSE SLES 12 repos

Open nephilim1973 opened this issue 8 years ago • 6 comments

Hi, I have a feature request for your script.

For mirroring SLES repos, you have to give a token with each download URL/file.

https://updates.suse.com/SUSE/Products/SLE-SERVER/12/x86_64/product/?<token>

You could generate your own token, if you paste a valid "Registration Code" from SuSE Customer Center https://scc.suse.com/subscriptions in this command line:

curl -H "Authorization: Token token=YourRegistrationCode" https://scc.suse.com/connect/subscriptions/products | tr "," "\n" | grep -i "url" | grep -i "SLE-SERVER"

Output example:

https://updates.suse.com/SUSE/Products/SLE-SERVER/12/x86_64/product/?lWDDA38y7a1zHcZrMj2aTSNun-Su4vB7Q6E1fe2JG4BYyonwRpTRjiqTXFtYuXMuZpsLBDfDbVbHki5waK1vBF0bfZAhGkd_3SiR_0s3XuOYqIqhwedet5ZiUx9NiULiF6X6RzF6dLB9
https://updates.suse.com/SUSE/Products/SLE-SERVER/12-SP1/x86_64/product/?a1U84xkEgkn2sy08EZm8lJdZ6N6bTWpyWT_ASOHCSdAfHg34saaSeICJV_CJbOLHVEfpZ07iRiIJpRIzYSv-T-1qMIUX8qMQ4bTjB5_ggFtI209CYrWGQOpSsCkT_vFXVqpNeIDmEgGA9b1ikQ

Just to avoid misunderstandings: For EACH file to download, you have to add the ?<token> to the URL.

So, it would be very nice, if you could add a config option "auth_token", where the token could be stored for each repo (every repo has its own token). If this option is set, and if repo is a SuSE SLES repo, each file/download URL should expanded with ?$auth_token string

Thanks and regards.

nephilim1973 avatar Apr 14 '16 15:04 nephilim1973

Under the hood, repo_sync (part of yum utils) is being used to mirror repositories. Can you sync the repo successfully if set url = https://updates.suse.com/SUSE/Products/SLE-SERVER/12/x86_64/product/?YOUR_API_KEY?

pyther avatar Apr 14 '16 15:04 pyther

Unfortunatelly not.

yum.Errors.NoMoreMirrorsRepoError: failure: repodata/repomd.xml from sles12: [Errno 256] No more mirrors to try.
https://updates.suse.com/SUSE/Products/SLE-SERVER/12/x86_64/product/?AAAAAAAAAAAAAAAA-LEMuj9nkfRSSbGhKjhMWQLnBEAcUmETDG20VIWbt1VJWZvF0EFoVPhMtOM4f6YE0USY_jeRzGnHXDGuZLL1YI7H3dVKSHZumIaCAHtahtvhomMFZYOZE7P4UD6K/repodata/repomd.xml: [Errno -1] Error importing repomd.xml for sles12: Damaged repomd.xml file

The reason for that is, that the repomd.xml should be downloaded without the trailing ?AAAAAAAAAAAAAAAA-LEMuj9nkfRSSbGhKjhMWQLnBEAcUmETDG20VIWbt1VJWZvF0EFoVPhMtOM4f6YE0USY_jeRzGnHXDGuZLL1YI7H3dVKSHZumIaCAHtahtvhomMFZYOZE7P4UD6K

The above URL https://updates.suse.com/SUSE/Products/SLE-SERVER/12/x86_64/product/?AAAAAAAAAAAAAAAA-LEMuj9nkfRSSbGhKjhMWQLnBEAcUmETDG20VIWbt1VJWZvF0EFoVPhMtOM4f6YE0USY_jeRzGnHXDGuZLL1YI7H3dVKSHZumIaCAHtahtvhomMFZYOZE7P4UD6K/repodata/repomd.xml is unuseable.

Correct URL should be:

https://updates.suse.com/SUSE/Products/SLE-SERVER/12/x86_64/product/repodata/repomd.xml?AAAAAAAAAAAAAAAA-LEMuj9nkfRSSbGhKjhMWQLnBEAcUmETDG20VIWbt1VJWZvF0EFoVPhMtOM4f6YE0USY_jeRzGnHXDGuZLL1YI7H3dVKSHZumIaCAHtahtvhomMFZYOZE7P4UD6K

nephilim1973 avatar Apr 14 '16 16:04 nephilim1973

With upstream_sync, upstream_sync generates the proper yum.conf for use by reposync.

You can see the commands upstream_sync is running with the -c option

pyther avatar Apr 14 '16 16:04 pyther

Ok, i will try this....

nephilim1973 avatar Apr 14 '16 16:04 nephilim1973

$ upstream_sync.py -c
sles12:
  reposync -c /var/tmp/upstream_sync-linuxteam/sles12.repo -r sles12 -p /mirror/sles12 --arch x86_64 --tempcache --norepopath --downloadcomps --newest-only --delete -q
  createrepo --pretty --database --update --cachedir /mirror/sles12/.cache /mirror/sles12 -q
$ reposync -c /var/tmp/upstream_sync-linuxteam/sles12.repo -r sles12 -p /mirror/sles12 --arch x86_64 --tempcache --norepopath --downloadcomps --newest-only --delete -q

yum.Errors.NoMoreMirrorsRepoError: failure: repodata/repomd.xml from sles12: [Errno 256] No more mirrors to try.
https://updates.suse.com/SUSE/Products/SLE-SERVER/12/x86_64/product/?AAAAAAAAAAAAAAAA-LEMuj9nkfRSEHzHvPhMWQLnBEAcUmETDG20VIWbt1VJWZvF0EFoVPhMtOM4f6YE0USY_jeRzGnHXDGuZLL1YI7H3dVKSHZuAdHgFdtahtvhomMFZYOZE7P4UD6K/repodata/repomd.xml: [Errno -1] Error importing repomd.xml for sles12: Damaged repomd.xml file

--> Same issue here... Wrong URL

nephilim1973 avatar Apr 14 '16 16:04 nephilim1973

That makes sense. Reading the yum page, it does not appear there is an option add a suffix to all urls. Yum support HTTP Basic Auth and HTTPS Client Authentication.

Unfortunately I don't have a good solution.

pyther avatar Apr 14 '16 16:04 pyther