diff --git a/muranodashboard/panel/services/fields.py b/muranodashboard/panel/services/fields.py index 8e4c79e4d..862cc3939 100644 --- a/muranodashboard/panel/services/fields.py +++ b/muranodashboard/panel/services/fields.py @@ -38,7 +38,14 @@ def with_request(func): return update -class CustomPropertiesField(object): +class CustomPropertiesField(forms.Field): + def clean(self, value): + """Skip all validators if field is disabled.""" + if getattr(self, 'enabled', True): + return super(CustomPropertiesField, self).clean(value) + else: + return super(CustomPropertiesField, self).to_python(value) + @classmethod def push_properties(cls, kwargs): props = {} diff --git a/muranodashboard/panel/services/forms.py b/muranodashboard/panel/services/forms.py index a018812b1..2f41aea37 100644 --- a/muranodashboard/panel/services/forms.py +++ b/muranodashboard/panel/services/forms.py @@ -253,7 +253,8 @@ class ServiceConfigurationForm(UpdatableFieldsForm): raise forms.ValidationError(error_messages) for name, field in self.fields.iteritems(): - if isinstance(field, fields.PasswordField): + if (isinstance(field, fields.PasswordField) and + getattr(field, 'enabled', True)): field.compare(name, cleaned_data) if hasattr(field, 'postclean'): diff --git a/muranodashboard/services/MsSqlClusterServer.yaml b/muranodashboard/services/MsSqlClusterServer.yaml index 5e4d2c56b..eecb6aa18 100644 --- a/muranodashboard/services/MsSqlClusterServer.yaml +++ b/muranodashboard/services/MsSqlClusterServer.yaml @@ -58,18 +58,18 @@ forms: - name: domainAdminUserName type: string label: Active Directory User - required: {YAQL: $.serviceConfiguration.externalAD} + enabled: {YAQL: $.serviceConfiguration.externalAD} regexpValidator: '^[-\w]+$' errorMessages: - invalid: 'Just letters, numbers, underscores and hyphens are allowed.' + invalid: Just letters, numbers, underscores and hyphens are allowed. - name: domainAdminPassword type: password label: Active Directory Password - required: {YAQL: $.serviceConfiguration.externalAD} + enabled: {YAQL: $.serviceConfiguration.externalAD} - name: domain type: domain label: Domain - required: {YAQL: not $.serviceConfiguration.externalAD} + enabled: {YAQL: not $.serviceConfiguration.externalAD} description: >- Service can be joined to the Active Directory domain. If you want to create an AD domain create the AD Service first. @@ -89,7 +89,7 @@ forms: label: SA Password description: Set system administrator password for the MS SQL Server. helpText: SQL server System Administrator account - required: {YAQL: $.serviceConfiguration.mixedModeAuth} + enabled: {YAQL: $.serviceConfiguration.mixedModeAuth} - clusterConfiguration: fields: - name: clusterIP