feat(itim): Ability to add configuration to cluster type
ref: #247 closes #71
This commit is contained in:
@ -39,6 +39,16 @@ class ClusterType(TenancyObject):
|
||||
|
||||
slug = AutoSlugField()
|
||||
|
||||
|
||||
config = models.JSONField(
|
||||
blank = True,
|
||||
default = None,
|
||||
help_text = 'Cluster Type Configuration that is applied to all clusters of this type',
|
||||
null = True,
|
||||
verbose_name = 'Configuration',
|
||||
)
|
||||
|
||||
|
||||
created = AutoCreatedField()
|
||||
|
||||
modified = AutoLastModifiedField()
|
||||
@ -131,6 +141,28 @@ class Cluster(TenancyObject):
|
||||
modified = AutoLastModifiedField()
|
||||
|
||||
|
||||
@property
|
||||
def rendered_config(self):
|
||||
|
||||
rendered_config: dict = {}
|
||||
|
||||
if self.cluster_type.config:
|
||||
|
||||
rendered_config.update(
|
||||
self.cluster_type.config
|
||||
)
|
||||
|
||||
if self.config:
|
||||
|
||||
rendered_config.update(
|
||||
self.config
|
||||
)
|
||||
|
||||
|
||||
|
||||
return rendered_config
|
||||
|
||||
|
||||
def __str__(self):
|
||||
|
||||
return self.name
|
||||
|
Reference in New Issue
Block a user