Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Fix migration of sles_auth_token
Browse files Browse the repository at this point in the history
  • Loading branch information
m-bucher authored and goosemania committed Oct 1, 2021
1 parent e16eed2 commit 954e53f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/9456.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed migration of sles_auth_token (backported from #9254)
7 changes: 7 additions & 0 deletions pulp_2to3_migration/app/plugin/rpm/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
)
from pulp_rpm.app.tasks.publishing import publish

from urllib.parse import urlparse, urlunparse


class RpmImporter(Pulp2to3Importer):
"""
Expand All @@ -35,6 +37,11 @@ def migrate_to_pulp3(cls, pulp2importer):
sles_auth_token = pulp2_config.get('query_auth_token')
if sles_auth_token:
base_config['sles_auth_token'] = sles_auth_token
else:
url = urlparse(pulp2_config.get('feed', ''))
if url.query and '=' not in url.query and '&' not in url.query:
base_config['sles_auth_token'] = url.query
base_config['url'] = urlunparse(url._replace(query=''))
return RpmRemote.objects.update_or_create(name=name, defaults=base_config)


Expand Down

0 comments on commit 954e53f

Please sign in to comment.