Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
cb06d54d4c | |||
e665ba79d7 | |||
1a6dcdeb78 | |||
c478284764 |
1
.python-version
Normal file
1
.python-version
Normal file
@ -0,0 +1 @@
|
|||||||
|
3.12.1
|
3
Pipfile
3
Pipfile
@ -9,4 +9,5 @@ giteapy-soteria = {git = "https://github.com/Yousif-CS/giteapy.git"}
|
|||||||
[dev-packages]
|
[dev-packages]
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.10"
|
python_version = "3.12"
|
||||||
|
|
||||||
|
18
Pipfile.lock
generated
18
Pipfile.lock
generated
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "1dc9e96fd5a12468ed7d0869b11b9fbca2464e4b806fb8b9c17391a41b6f0eb8"
|
"sha256": "5041607b8b692ebdc03484547b2d4336083196ff75b38c3140b608a7d59abaf8"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
"python_version": "3.10"
|
"python_version": "3.12"
|
||||||
},
|
},
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
@ -18,11 +18,11 @@
|
|||||||
"default": {
|
"default": {
|
||||||
"certifi": {
|
"certifi": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3",
|
"sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1",
|
||||||
"sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"
|
"sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.6'",
|
"markers": "python_version >= '3.6'",
|
||||||
"version": "==2022.12.7"
|
"version": "==2023.11.17"
|
||||||
},
|
},
|
||||||
"giteapy-soteria": {
|
"giteapy-soteria": {
|
||||||
"git": "https://github.com/Yousif-CS/giteapy.git",
|
"git": "https://github.com/Yousif-CS/giteapy.git",
|
||||||
@ -46,11 +46,11 @@
|
|||||||
},
|
},
|
||||||
"urllib3": {
|
"urllib3": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:076907bf8fd355cde77728471316625a4d2f7e713c125f51953bb5b3eecf4f72",
|
"sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3",
|
||||||
"sha256:75edcdc2f7d85b137124a6c3c9fc3933cdeaa12ecb9a6a959f22797a0feca7e1"
|
"sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",
|
"markers": "python_version >= '3.8'",
|
||||||
"version": "==1.26.14"
|
"version": "==2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"develop": {}
|
"develop": {}
|
||||||
|
@ -6,7 +6,7 @@ Supports changing destination names a bit, and adding topics to each transferred
|
|||||||
|
|
||||||
by Mike Peralta
|
by Mike Peralta
|
||||||
|
|
||||||
Current license: You are free to clone and use this program but all other rights reserved, provided you accept 100% of all liability of any outcome of use/download/etc this program. Better license coming soon.
|
Current license: You are free to clone and use this program but all other rights reserved, provided you accept 100% of all liability of any outcome of use/download/etc. this program. Better license coming soon.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ import giteapy
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import certifi
|
||||||
|
|
||||||
|
|
||||||
class Migrator:
|
class Migrator:
|
||||||
|
|
||||||
@ -101,6 +103,15 @@ class Migrator:
|
|||||||
|
|
||||||
self.__verify_ssl = b
|
self.__verify_ssl = b
|
||||||
|
|
||||||
|
def set_ca_bundle(self, bundle_path: str):
|
||||||
|
|
||||||
|
self.__logger.info("Setting certificate bundle path")
|
||||||
|
|
||||||
|
# Hacky but oh well
|
||||||
|
self.__logger.info(f"Old path: {certifi.where()}")
|
||||||
|
certifi.core._CACERT_PATH = bundle_path
|
||||||
|
self.__logger.info(f"New path: {certifi.where()}")
|
||||||
|
|
||||||
def migrate_entire_org(
|
def migrate_entire_org(
|
||||||
self,
|
self,
|
||||||
interactive: bool = True,
|
interactive: bool = True,
|
||||||
@ -118,6 +129,9 @@ class Migrator:
|
|||||||
api_source: giteapy.OrganizationApi
|
api_source: giteapy.OrganizationApi
|
||||||
api_destination: giteapy.OrganizationApi
|
api_destination: giteapy.OrganizationApi
|
||||||
|
|
||||||
|
# Tattle on certify
|
||||||
|
self.__logger.info(f"Certifi is currently using CA bundle: {certifi.where()}")
|
||||||
|
|
||||||
# Grab all org repos
|
# Grab all org repos
|
||||||
source_repos = self._fetch_all_org_repos(org=source_org)
|
source_repos = self._fetch_all_org_repos(org=source_org)
|
||||||
self.__logger.info(f"Found {len(source_repos)} repos on source:")
|
self.__logger.info(f"Found {len(source_repos)} repos on source:")
|
||||||
|
15
main.py
15
main.py
@ -23,7 +23,7 @@ def main():
|
|||||||
dest="source_port",
|
dest="source_port",
|
||||||
required=False,
|
required=False,
|
||||||
default=None,
|
default=None,
|
||||||
help="Port of the source server"
|
help="Port of the source server. Requests will use https (not ssh), so you probably don't want to change this."
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--source-token",
|
"--source-token",
|
||||||
@ -57,7 +57,7 @@ def main():
|
|||||||
dest="destination_port",
|
dest="destination_port",
|
||||||
required=False,
|
required=False,
|
||||||
default=None,
|
default=None,
|
||||||
help="Port of the destination server"
|
help="Port of the destination server. Requests will use https (not ssh), so you probably don't want to change this."
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--destination-token", "--dest-token",
|
"--destination-token", "--dest-token",
|
||||||
@ -124,6 +124,13 @@ def main():
|
|||||||
help="Don't verify SSL certificates",
|
help="Don't verify SSL certificates",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--ca-bundle",
|
||||||
|
dest="ca_bundle",
|
||||||
|
default=None,
|
||||||
|
help="Specify the location of your system-wide CA Bundle, in case python is not using it."
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
mig = Migrator(
|
mig = Migrator(
|
||||||
source_host=args.source_hostname,
|
source_host=args.source_hostname,
|
||||||
@ -133,7 +140,11 @@ def main():
|
|||||||
destination_port=args.destination_port,
|
destination_port=args.destination_port,
|
||||||
destination_token=args.destination_token
|
destination_token=args.destination_token
|
||||||
)
|
)
|
||||||
|
|
||||||
mig.set_verify_ssl(args.verify_ssl)
|
mig.set_verify_ssl(args.verify_ssl)
|
||||||
|
if args.ca_bundle:
|
||||||
|
mig.set_ca_bundle(args.ca_bundle)
|
||||||
|
|
||||||
mig.migrate_entire_org(
|
mig.migrate_entire_org(
|
||||||
interactive=args.interactive,
|
interactive=args.interactive,
|
||||||
source_org=args.source_org,
|
source_org=args.source_org,
|
||||||
|
Reference in New Issue
Block a user