From ef6caade86de5d368fdac75b11541fc70b05b050 Mon Sep 17 00:00:00 2001 From: Adam Lewis <23342526+Adam-D-Lewis@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:09:10 -0500 Subject: [PATCH] revert exclude from config --- src/_nebari/stages/infrastructure/__init__.py | 7 ----- src/nebari/plugins.py | 27 +++---------------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/src/_nebari/stages/infrastructure/__init__.py b/src/_nebari/stages/infrastructure/__init__.py index cdc2fe88c7..8b188a720b 100644 --- a/src/_nebari/stages/infrastructure/__init__.py +++ b/src/_nebari/stages/infrastructure/__init__.py @@ -565,13 +565,6 @@ class InputSchema(schema.Base): azure: Optional[AzureProvider] = None digital_ocean: Optional[DigitalOceanProvider] = None - def exclude_from_config(self): - exclude = set() - for provider in InputSchema.model_fields: - if getattr(self, provider) is None: - exclude.add(provider) - return exclude - @model_validator(mode="before") @classmethod def check_provider(cls, data: Any) -> Any: diff --git a/src/nebari/plugins.py b/src/nebari/plugins.py index de4a06e4ca..c5148e9e1d 100644 --- a/src/nebari/plugins.py +++ b/src/nebari/plugins.py @@ -124,32 +124,11 @@ def ordered_stages(self): return self.get_available_stages() @property - def ordered_schemas(self): - return [schema.Main] + [ + def config_schema(self): + classes = [schema.Main] + [ _.input_schema for _ in self.ordered_stages if _.input_schema is not None ] - - @property - def config_schema(self): - ordered_schemas = self.ordered_schemas - - def write_config(self): - config_exclude = set() - for cls in self._ordered_schemas: - if hasattr(cls, "exclude_from_config"): - new_exclude = cls.exclude_from_config(self) - config_exclude = config_exclude.union(new_exclude) - return self.model_dump(exclude=config_exclude) - - ConfigSchema = type( - "ConfigSchema", - tuple(ordered_schemas[::-1]), - { - "_ordered_schemas": ordered_schemas, - "write_config": write_config, - }, - ) - return ConfigSchema + return type("ConfigSchema", tuple(classes), {}) nebari_plugin_manager = NebariPluginManager()