diff --git a/tdp/cli/commands/vars/edit.py b/tdp/cli/commands/vars/edit.py index 8246442d..d1f1f65f 100644 --- a/tdp/cli/commands/vars/edit.py +++ b/tdp/cli/commands/vars/edit.py @@ -96,7 +96,7 @@ def edit( # Check if component exists entity_name = parse_entity_name(variables_file.stem) if isinstance(entity_name, ServiceComponentName): - if entity_name not in collections.hostable_entities[service_name]: + if entity_name not in collections.entities[service_name]: raise click.ClickException( f"Error unknown component '{entity_name.component}' for service '{entity_name.service}'" ) diff --git a/tdp/cli/params/status/component_argument.py b/tdp/cli/params/status/component_argument.py index 42dcf150..3fac64e0 100644 --- a/tdp/cli/params/status/component_argument.py +++ b/tdp/cli/params/status/component_argument.py @@ -19,7 +19,7 @@ def _check_component( collections: Collections = ctx.params["collections"] service: str = ctx.params["service"] if value and value not in [ - sc_name.component for sc_name in collections.hostable_entities[service] + sc_name.component for sc_name in collections.entities[service] ]: raise click.UsageError( f"Component '{value}' does not exists in service '{service}'." diff --git a/tdp/core/collections/collections.py b/tdp/core/collections/collections.py index 5ad7311f..4f698560 100644 --- a/tdp/core/collections/collections.py +++ b/tdp/core/collections/collections.py @@ -52,7 +52,7 @@ def __init__(self, collections: Iterable[CollectionReader]): self._dag_operations, self._other_operations = self._init_operations() self._default_var_directories = self._init_default_vars_dirs() self._schemas = self._init_schemas() - self._services_components = self._init_hostable_entities() + self._services_components = self._init_entities() @staticmethod def from_collection_paths( @@ -102,7 +102,7 @@ def schemas(self) -> dict[str, ServiceSchema]: # ? The mapping is using service name as a string for convenience. Should we keep # ? this or change it to ServiceName? @property - def hostable_entities(self) -> dict[str, set[ServiceComponentName]]: + def entities(self) -> dict[str, set[ServiceComponentName]]: """Mapping of services to their set of components.""" return self._services_components @@ -232,7 +232,7 @@ def _init_schemas(self) -> dict[str, ServiceSchema]: schemas.setdefault(schema.service, ServiceSchema()).add_schema(schema) return schemas - def _init_hostable_entities(self) -> dict[str, set[ServiceComponentName]]: + def _init_entities(self) -> dict[str, set[ServiceComponentName]]: services_components: dict[str, set[ServiceComponentName]] = {} for operation in self.operations.values(): service = services_components.setdefault(operation.name.service, set()) diff --git a/test_dag_order/helpers.py b/test_dag_order/helpers.py index ac375686..efe6d2be 100644 --- a/test_dag_order/helpers.py +++ b/test_dag_order/helpers.py @@ -187,7 +187,7 @@ def resolve_components( service_component_map: dict[str, str] = {} for service_component in service_components: if isinstance(parse_entity_name(service_component), ServiceName): - for component in collections.hostable_entities[service_component]: + for component in collections.entities[service_component]: resolved_components.add(component.name) service_component_map[component.name] = service_component else: