Skip to content

Commit

Permalink
revert exclude from config
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam-D-Lewis committed Jun 4, 2024
1 parent e771897 commit ef6caad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
7 changes: 0 additions & 7 deletions src/_nebari/stages/infrastructure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 3 additions & 24 deletions src/nebari/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit ef6caad

Please sign in to comment.