Skip to content

Commit

Permalink
fix: validate database service configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabh6790 committed Jul 30, 2024
1 parent 76ee562 commit 166ff2e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions press/press/doctype/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,20 @@ 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 hasattr(self, "is_managed_database") and 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)

Expand Down

0 comments on commit 166ff2e

Please sign in to comment.