feat(itim): dont force config key, validate when it's required
ref: #247 #69
This commit is contained in:
@ -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:
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user