diff --git a/gso/migrations/env.py b/gso/migrations/env.py index 1b039d7fe43ce29e53e06791acf246d39c1ad88e..2f41e241668abfc8989a2ff01d91cd5099fb0bc4 100644 --- a/gso/migrations/env.py +++ b/gso/migrations/env.py @@ -68,8 +68,12 @@ def run_migrations_online() -> None: directives[:] = [] logger.info("No changes in schema detected.") + config_section = config.get_section(config.config_ini_section) + if config_section is None: + raise ValueError("Config section not found!") + engine = engine_from_config( - config.get_section(config.config_ini_section), prefix="sqlalchemy.", poolclass=pool.NullPool + config_section, prefix="sqlalchemy.", poolclass=pool.NullPool ) connection = engine.connect() diff --git a/gso/workflows/tasks/import_iptrunk.py b/gso/workflows/tasks/import_iptrunk.py index 72dddffc209f2c2fde908dfc67ac0624933b18df..db4cb347446b56ac15f0592635e2afc4414cb1c3 100644 --- a/gso/workflows/tasks/import_iptrunk.py +++ b/gso/workflows/tasks/import_iptrunk.py @@ -1,5 +1,4 @@ import ipaddress -from uuid import UUID from orchestrator import workflow from orchestrator.forms import FormPage @@ -65,7 +64,7 @@ def initial_input_form_generator() -> FormGenerator: @step("Create a new subscription") def create_subscription(customer: str) -> State: - customer_id: UUID = get_customer_by_name(customer)["id"] + customer_id = get_customer_by_name(customer)["id"] product_id = subscriptions.get_product_id_by_name(ProductType.IP_TRUNK) subscription = IptrunkInactive.from_product_id(product_id, customer_id) diff --git a/gso/workflows/tasks/import_router.py b/gso/workflows/tasks/import_router.py index 9e0a433798091810d15c2662d5c2de9e06a04ba9..4d157709cb8f1b3b2e9a391e27af0f8278ad6c93 100644 --- a/gso/workflows/tasks/import_router.py +++ b/gso/workflows/tasks/import_router.py @@ -36,7 +36,7 @@ def _get_site_by_name(site_name: str) -> Site: @step("Create subscription") def create_subscription(customer: str) -> State: - customer_id: UUID = get_customer_by_name(customer)["id"] + customer_id = get_customer_by_name(customer)["id"] product_id: UUID = subscriptions.get_product_id_by_name(ProductType.ROUTER) subscription = RouterInactive.from_product_id(product_id, customer_id) diff --git a/gso/workflows/tasks/import_site.py b/gso/workflows/tasks/import_site.py index 0d03ed875fa5f53178ed21382ee6d741774c27d2..20967c71c2f12e16bd78081538eb89979fb1baf1 100644 --- a/gso/workflows/tasks/import_site.py +++ b/gso/workflows/tasks/import_site.py @@ -16,7 +16,7 @@ from gso.workflows.site.create_site import initialize_subscription @step("Create subscription") def create_subscription(customer: str) -> State: - customer_id: UUID = get_customer_by_name(customer)["id"] + customer_id = get_customer_by_name(customer)["id"] product_id: UUID = subscriptions.get_product_id_by_name(ProductType.SITE) subscription = SiteInactive.from_product_id(product_id, customer_id) diff --git a/requirements.txt b/requirements.txt index 29e9766baf30dd5049e8b3133975a217ee9de23a..8b230dfd5001ec8ce78d940f8a7c01eb4a74bdd7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,15 @@ orchestrator-core==1.3.0 -requests +requests==2.31.0 infoblox-client~=0.6.0 -pycountry +pycountry==22.3.5 -pytest -faker -responses -black -isort -flake8 -mypy -ruff -sphinx -sphinx-rtd-theme -typer \ No newline at end of file +pytest==7.4.2 +faker==19.6.2 +responses==0.23.3 +black==23.9.1 +isort==5.12.0 +flake8==6.1.0 +mypy==1.5.1 +ruff==0.0.290 +sphinx==7.2.6 +sphinx-rtd-theme==1.3.0 diff --git a/setup.py b/setup.py index 92b2801af2a93f21ecc9af04389d6289901f8db5..dfb10261429cff5d6ad93876fc8964eb564b65cc 100644 --- a/setup.py +++ b/setup.py @@ -9,10 +9,9 @@ setup( url="https://gitlab.software.geant.org/goat/gap/geant-service-orchestrator", packages=find_packages(), install_requires=[ - "orchestrator-core==1.2.2", - "pydantic~=1.10.9", - "requests~=2.31.0", + "orchestrator-core==1.3.0", + "requests==2.31.0", "infoblox-client~=0.6.0", - "pycountry", + "pycountry==22.3.5", ], ) diff --git a/test/conftest.py b/test/conftest.py index ff3cb944368d8c4f08c424826e3a95f41e3c91f1..a811b7c34665c993f704b16ae0e2528f90e4ea82 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -171,7 +171,9 @@ def database(db_uri): with engine.connect() as conn: conn.execute(text("COMMIT;")) conn.execute( - text("SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname=:dbname"), dbname=db_to_create + text("SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname=:db_name").bindparams( + db_name=db_to_create + ) ) conn.execute(text(f'DROP DATABASE IF EXISTS "{db_to_create}";'))