diff --git a/controlpanel/frontend/forms.py b/controlpanel/frontend/forms.py index 5e04f09e..c688ace2 100644 --- a/controlpanel/frontend/forms.py +++ b/controlpanel/frontend/forms.py @@ -189,6 +189,15 @@ def clean(self): if connect_data_source == "existing" and not existing_datasource: self.add_error("existing_datasource_id", "This field is required.") + assume_role = cleaned_data.get("allow_cloud_platform_assume_role") + role_arn = cleaned_data.get("cloud_platform_role_arn") + + if assume_role and not role_arn: + self.add_error("cloud_platform_role_arn", "Role ARN is required") + + if not assume_role and role_arn: + cleaned_data.pop("cloud_platform_role_arn") + return cleaned_data def clean_repo_url(self): diff --git a/controlpanel/frontend/views/app.py b/controlpanel/frontend/views/app.py index 3d43529d..1b7e1ef7 100644 --- a/controlpanel/frontend/views/app.py +++ b/controlpanel/frontend/views/app.py @@ -200,15 +200,6 @@ def get_success_url(self): def form_valid(self, form): try: - assume_role = form.cleaned_data.get("allow_cloud_platform_assume_role") - role_arn = form.cleaned_data.get("cloud_platform_role_arn") - if assume_role and not role_arn: - form.add_error("cloud_platform_role_arn", "Role ARN is required") - return FormMixin.form_invalid(self, form) - - if not assume_role and role_arn: - form.cleaned_data.pop("cloud_platform_role_arn") - self.object = AppManager().register_app(self.request.user, form.cleaned_data) except Exception as ex: form.add_error("repo_url", str(ex)) diff --git a/settings.yaml b/settings.yaml index 31f0a63b..b024537b 100644 --- a/settings.yaml +++ b/settings.yaml @@ -13,7 +13,7 @@ enabled_features: _HOST_prod: true cloud_platform_assume_role: _DEFAULT: false - _HOST_dev: false + _HOST_dev: true _HOST_prod: false _HOST_alpha: false