From 6bb3bc6e66027ec53bc4654299bea0b99e445af2 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 30 Jul 2024 14:49:04 +0530 Subject: [PATCH] fix: validate database service configuration --- press/press/doctype/server/server.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/press/press/doctype/server/server.py b/press/press/doctype/server/server.py index 12eb018a0a8..486f4cbc316 100644 --- a/press/press/doctype/server/server.py +++ b/press/press/doctype/server/server.py @@ -186,11 +186,19 @@ def autoname(self): def validate(self): self.validate_cluster() self.validate_agent_password() + self.validate_managed_database_instance() if self.doctype == "Database Server" and not self.self_hosted_mariadb_server: self.self_hosted_mariadb_server = self.private_ip if not self.hostname_abbreviation: self._set_hostname_abbreviation() + + def validate_managed_database_instance(self): + if self.is_managed_database: + if not self.managed_database_service: + frappe.throw(_("Managed Database Service is required")) + + self.database_server = '' def _set_hostname_abbreviation(self): self.hostname_abbreviation = get_hostname_abbreviation(self.hostname)