diff --git a/Pipfile.lock b/Pipfile.lock index 5fe0d49..46ff1af 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -36,7 +36,7 @@ "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.8.2" }, "six": { @@ -44,7 +44,7 @@ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.16.0" }, "urllib3": { diff --git a/domain/Migrator.py b/domain/Migrator.py index 8771b9e..5c89285 100644 --- a/domain/Migrator.py +++ b/domain/Migrator.py @@ -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}")