feat(itim): dont force config key, validate when it's required

ref: #247 #69
This commit is contained in:
2024-08-19 16:12:40 +09:30
parent 32f45f2d5f
commit cf5c512a64
2 changed files with 6 additions and 1 deletions

View File

@ -44,6 +44,7 @@ class ServiceForm(CommonModelForm):
dependent_service = cleaned_data.get("dependent_service")
device = cleaned_data.get("device")
cluster = cleaned_data.get("cluster")
config_key_variable = cleaned_data.get("config_key_variable")
is_template = cleaned_data.get("is_template")
template = cleaned_data.get("template")
port = cleaned_data.get("port")
@ -65,6 +66,10 @@ class ServiceForm(CommonModelForm):
raise ValidationError('Port(s) must be assigned to a service.')
if not is_template and not config_key_variable:
raise ValidationError('Configuration Key must be specified')
if dependent_service:
for dependency in dependent_service:

View File

@ -169,7 +169,7 @@ class Service(TenancyObject):
)
config_key_variable = models.CharField(
blank = False,
blank = True,
help_text = 'Key name to use when merging with cluster/device config.',
max_length = 50,
null = True,