This commit is contained in:
2023-01-17 23:33:27 -08:00
parent 858d9be514
commit 5b1187cf65
2 changed files with 23 additions and 2 deletions

View File

@ -38,6 +38,16 @@ class Migrator:
self.__logger = logger
def _get_repo_api(self, hostname, port, token):
conf = giteapy.Configuration()
conf.api_key['access_token'] = token
conf.host = self._make_api_base(hostname=hostname, port=port)
conf.verify_ssl = self.__verify_ssl
api = giteapy.RepositoryApi(giteapy.ApiClient(conf))
return api
def _get_org_apis(self):
api_source = self._get_org_api(
@ -170,6 +180,17 @@ class Migrator:
description=repo.description,
labels=True, issues=True, pull_requests=True, releases=True, milestones=True, wiki=True
)
migrate_body.auth_token = self.__source_token
migrate_body.swagger_types["auth_token"] = "str"
migrate_body.attribute_map["auth_token"] = "auth_token"
self.__logger.info("Migrate body:")
self.__logger.info(migrate_body)
destination_api = self._get_repo_api(
hostname=self.__destination_host,
port=self.__destination_port,
token=self.__destination_token,
)
migration_result = destination_api.repo_migrate(body=migrate_body)
self.__logger.info(f"Migration result: {migration_result}")