diff --git a/data_safe_haven/administration/users/guacamole_users.py b/data_safe_haven/administration/users/guacamole_users.py index 4967c3e590..0e5b0b2792 100644 --- a/data_safe_haven/administration/users/guacamole_users.py +++ b/data_safe_haven/administration/users/guacamole_users.py @@ -2,7 +2,8 @@ from collections.abc import Sequence from typing import Any -from data_safe_haven.config import Config, Context, DSHPulumiProject +from data_safe_haven.config import Config, DSHPulumiProject +from data_safe_haven.context import Context from data_safe_haven.external import AzureApi, AzurePostgreSQLDatabase from data_safe_haven.infrastructure import SREStackManager diff --git a/data_safe_haven/administration/users/user_handler.py b/data_safe_haven/administration/users/user_handler.py index 64ff4c1552..82cbf27620 100644 --- a/data_safe_haven/administration/users/user_handler.py +++ b/data_safe_haven/administration/users/user_handler.py @@ -2,7 +2,8 @@ import pathlib from collections.abc import Sequence -from data_safe_haven.config import Config, Context, DSHPulumiConfig, DSHPulumiProject +from data_safe_haven.config import Config, DSHPulumiConfig, DSHPulumiProject +from data_safe_haven.context import Context from data_safe_haven.exceptions import DataSafeHavenUserHandlingError from data_safe_haven.external import GraphApi from data_safe_haven.utility import LoggingSingleton diff --git a/data_safe_haven/commands/admin_add_users.py b/data_safe_haven/commands/admin_add_users.py index 0b12f93a89..5a5535709c 100644 --- a/data_safe_haven/commands/admin_add_users.py +++ b/data_safe_haven/commands/admin_add_users.py @@ -3,7 +3,8 @@ import pathlib from data_safe_haven.administration.users import UserHandler -from data_safe_haven.config import Config, ContextSettings, DSHPulumiConfig +from data_safe_haven.config import Config, DSHPulumiConfig +from data_safe_haven.context import ContextSettings from data_safe_haven.exceptions import DataSafeHavenError from data_safe_haven.external import GraphApi diff --git a/data_safe_haven/commands/admin_list_users.py b/data_safe_haven/commands/admin_list_users.py index 26a168993f..274b525e2e 100644 --- a/data_safe_haven/commands/admin_list_users.py +++ b/data_safe_haven/commands/admin_list_users.py @@ -1,7 +1,8 @@ """List users from a deployed Data Safe Haven""" from data_safe_haven.administration.users import UserHandler -from data_safe_haven.config import Config, ContextSettings, DSHPulumiConfig +from data_safe_haven.config import Config, DSHPulumiConfig +from data_safe_haven.context import ContextSettings from data_safe_haven.exceptions import DataSafeHavenError from data_safe_haven.external import GraphApi diff --git a/data_safe_haven/commands/admin_register_users.py b/data_safe_haven/commands/admin_register_users.py index 8833631296..a4630b25ff 100644 --- a/data_safe_haven/commands/admin_register_users.py +++ b/data_safe_haven/commands/admin_register_users.py @@ -1,7 +1,8 @@ """Register existing users with a deployed SRE""" from data_safe_haven.administration.users import UserHandler -from data_safe_haven.config import Config, ContextSettings, DSHPulumiConfig +from data_safe_haven.config import Config, DSHPulumiConfig +from data_safe_haven.context import ContextSettings from data_safe_haven.exceptions import DataSafeHavenError from data_safe_haven.external import GraphApi from data_safe_haven.functions import sanitise_sre_name diff --git a/data_safe_haven/commands/admin_remove_users.py b/data_safe_haven/commands/admin_remove_users.py index 43e68d0324..fc9a01a00d 100644 --- a/data_safe_haven/commands/admin_remove_users.py +++ b/data_safe_haven/commands/admin_remove_users.py @@ -1,7 +1,8 @@ """Remove existing users from a deployed Data Safe Haven""" from data_safe_haven.administration.users import UserHandler -from data_safe_haven.config import Config, ContextSettings, DSHPulumiConfig +from data_safe_haven.config import Config, DSHPulumiConfig +from data_safe_haven.context import ContextSettings from data_safe_haven.exceptions import DataSafeHavenError from data_safe_haven.external import GraphApi diff --git a/data_safe_haven/commands/admin_unregister_users.py b/data_safe_haven/commands/admin_unregister_users.py index 0f4f9214d5..d13216891f 100644 --- a/data_safe_haven/commands/admin_unregister_users.py +++ b/data_safe_haven/commands/admin_unregister_users.py @@ -1,7 +1,8 @@ """Unregister existing users from a deployed SRE""" from data_safe_haven.administration.users import UserHandler -from data_safe_haven.config import Config, ContextSettings, DSHPulumiConfig +from data_safe_haven.config import Config, DSHPulumiConfig +from data_safe_haven.context import ContextSettings from data_safe_haven.exceptions import DataSafeHavenError from data_safe_haven.external import GraphApi from data_safe_haven.functions import sanitise_sre_name diff --git a/data_safe_haven/commands/config.py b/data_safe_haven/commands/config.py index dad06bc560..ba6d6397ca 100644 --- a/data_safe_haven/commands/config.py +++ b/data_safe_haven/commands/config.py @@ -6,7 +6,8 @@ import typer from rich import print -from data_safe_haven.config import Config, ContextSettings +from data_safe_haven.config import Config +from data_safe_haven.context import ContextSettings config_command_group = typer.Typer() diff --git a/data_safe_haven/commands/context.py b/data_safe_haven/commands/context.py index a445bd6412..be00008178 100644 --- a/data_safe_haven/commands/context.py +++ b/data_safe_haven/commands/context.py @@ -5,11 +5,11 @@ import typer from rich import print -from data_safe_haven.config import ( +from data_safe_haven.context import ( Context, + ContextInfra, ContextSettings, ) -from data_safe_haven.context import ContextInfra from data_safe_haven.functions.typer_validators import typer_validate_aad_guid context_command_group = typer.Typer() diff --git a/data_safe_haven/commands/deploy.py b/data_safe_haven/commands/deploy.py index 499c2031d5..10bc91ff54 100644 --- a/data_safe_haven/commands/deploy.py +++ b/data_safe_haven/commands/deploy.py @@ -4,7 +4,8 @@ import typer -from data_safe_haven.config import Config, ContextSettings, DSHPulumiConfig +from data_safe_haven.config import Config, DSHPulumiConfig +from data_safe_haven.context import ContextSettings from data_safe_haven.exceptions import DataSafeHavenError from data_safe_haven.external import GraphApi from data_safe_haven.functions import sanitise_sre_name diff --git a/data_safe_haven/commands/teardown.py b/data_safe_haven/commands/teardown.py index a99a969bb1..789fc71d9b 100644 --- a/data_safe_haven/commands/teardown.py +++ b/data_safe_haven/commands/teardown.py @@ -4,7 +4,8 @@ import typer -from data_safe_haven.config import Config, ContextSettings, DSHPulumiConfig +from data_safe_haven.config import Config, DSHPulumiConfig +from data_safe_haven.context import ContextSettings from data_safe_haven.exceptions import ( DataSafeHavenError, DataSafeHavenInputError, diff --git a/data_safe_haven/config/__init__.py b/data_safe_haven/config/__init__.py index 3d01e6d063..59e7e3b87c 100644 --- a/data_safe_haven/config/__init__.py +++ b/data_safe_haven/config/__init__.py @@ -1,13 +1,20 @@ -from .config import Config +from .config import ( + Config, + ConfigSectionAzure, + ConfigSectionSHM, + ConfigSectionSRE, + ConfigSubsectionRemoteDesktopOpts, +) from .config_class import ConfigClass -from .context_settings import Context, ContextSettings from .pulumi import DSHPulumiConfig, DSHPulumiProject __all__ = [ "Config", + "ConfigSectionAzure", + "ConfigSectionSHM", + "ConfigSectionSRE", + "ConfigSubsectionRemoteDesktopOpts", "ConfigClass", - "Context", - "ContextSettings", "DSHPulumiConfig", "DSHPulumiProject", ] diff --git a/data_safe_haven/config/config.py b/data_safe_haven/config/config.py index 8155b91b45..6762a599ec 100644 --- a/data_safe_haven/config/config.py +++ b/data_safe_haven/config/config.py @@ -10,7 +10,6 @@ field_validator, ) -from data_safe_haven.config import ConfigClass from data_safe_haven.exceptions import DataSafeHavenConfigError from data_safe_haven.functions.validators import validate_unique_list from data_safe_haven.utility import ( @@ -28,6 +27,8 @@ UniqueList, ) +from .config_class import ConfigClass + class ConfigSectionAzure(BaseModel, validate_assignment=True): subscription_id: Guid diff --git a/data_safe_haven/config/config_class.py b/data_safe_haven/config/config_class.py index 4a042b7a50..837f0e2b66 100644 --- a/data_safe_haven/config/config_class.py +++ b/data_safe_haven/config/config_class.py @@ -6,7 +6,7 @@ from pydantic import BaseModel, ValidationError from yaml import YAMLError -from data_safe_haven.config import Context +from data_safe_haven.context import Context from data_safe_haven.exceptions import ( DataSafeHavenConfigError, DataSafeHavenParameterError, diff --git a/data_safe_haven/context/__init__.py b/data_safe_haven/context/__init__.py index 3fb25abbf5..162321a746 100644 --- a/data_safe_haven/context/__init__.py +++ b/data_safe_haven/context/__init__.py @@ -1,5 +1,8 @@ from .context import ContextInfra +from .context_settings import Context, ContextSettings __all__ = [ + "Context", "ContextInfra", + "ContextSettings", ] diff --git a/data_safe_haven/context/context.py b/data_safe_haven/context/context.py index d706ddf70d..b131457043 100644 --- a/data_safe_haven/context/context.py +++ b/data_safe_haven/context/context.py @@ -1,7 +1,8 @@ -from data_safe_haven.config import Context from data_safe_haven.exceptions import DataSafeHavenAzureError from data_safe_haven.external import AzureApi +from .context_settings import Context + class ContextInfra: """Azure resources to support Data Safe Haven context""" diff --git a/data_safe_haven/config/context_settings.py b/data_safe_haven/context/context_settings.py similarity index 100% rename from data_safe_haven/config/context_settings.py rename to data_safe_haven/context/context_settings.py diff --git a/data_safe_haven/infrastructure/stack_manager.py b/data_safe_haven/infrastructure/stack_manager.py index 80cf844a64..08707c93a7 100644 --- a/data_safe_haven/infrastructure/stack_manager.py +++ b/data_safe_haven/infrastructure/stack_manager.py @@ -12,7 +12,8 @@ from pulumi import automation from pulumi.automation import ConfigValue -from data_safe_haven.config import Config, Context, DSHPulumiProject +from data_safe_haven.config import Config, DSHPulumiProject +from data_safe_haven.context import Context from data_safe_haven.exceptions import DataSafeHavenAzureError, DataSafeHavenPulumiError from data_safe_haven.external import AzureApi, AzureCliSingleton from data_safe_haven.functions import replace_separators diff --git a/data_safe_haven/infrastructure/stacks/declarative_shm.py b/data_safe_haven/infrastructure/stacks/declarative_shm.py index ac78da66cb..b6088e6a11 100644 --- a/data_safe_haven/infrastructure/stacks/declarative_shm.py +++ b/data_safe_haven/infrastructure/stacks/declarative_shm.py @@ -2,7 +2,8 @@ import pulumi -from data_safe_haven.config import Config, Context +from data_safe_haven.config import Config +from data_safe_haven.context import Context from .shm.data import SHMDataComponent, SHMDataProps from .shm.firewall import SHMFirewallComponent, SHMFirewallProps diff --git a/data_safe_haven/infrastructure/stacks/declarative_sre.py b/data_safe_haven/infrastructure/stacks/declarative_sre.py index 777c7b61f4..27ba413f5f 100644 --- a/data_safe_haven/infrastructure/stacks/declarative_sre.py +++ b/data_safe_haven/infrastructure/stacks/declarative_sre.py @@ -2,7 +2,8 @@ import pulumi -from data_safe_haven.config import Config, Context +from data_safe_haven.config import Config +from data_safe_haven.context import Context from data_safe_haven.infrastructure.common import get_subscription_id_from_rg from .sre.application_gateway import ( diff --git a/tests/commands/conftest.py b/tests/commands/conftest.py index 08e00dfef9..edbd8e1292 100644 --- a/tests/commands/conftest.py +++ b/tests/commands/conftest.py @@ -1,7 +1,7 @@ from pytest import fixture from typer.testing import CliRunner -from data_safe_haven.config_settings import ContextSettings +from data_safe_haven.context import ContextSettings @fixture diff --git a/tests/config/test_context_settings.py b/tests/config/test_context_settings.py index bff36ca2ec..eb7afa75d3 100644 --- a/tests/config/test_context_settings.py +++ b/tests/config/test_context_settings.py @@ -3,7 +3,7 @@ from pydantic import ValidationError from pytest import fixture -from data_safe_haven.config_settings import Context, ContextSettings +from data_safe_haven.context import Context, ContextSettings from data_safe_haven.exceptions import ( DataSafeHavenConfigError, DataSafeHavenParameterError, diff --git a/tests/conftest.py b/tests/conftest.py index 54eda031c9..dc8bae0b41 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,7 +2,7 @@ from pytest import fixture -import data_safe_haven.config.context_settings as context_mod +import data_safe_haven.context.context_settings as context_mod from data_safe_haven.config import ( Config, ConfigSectionAzure, @@ -12,7 +12,7 @@ DSHPulumiConfig, DSHPulumiProject, ) -from data_safe_haven.config_settings import Context +from data_safe_haven.context import Context from data_safe_haven.external import AzureApi