Files
cloud/press/patches/v0_7_0/set_hostname_abbreviation.py
Aditya Hase 01770acb83 style: Ruff
I: Sort imports
2024-07-13 19:18:51 +05:30

16 lines
440 B
Python

import frappe
from press.press.doctype.server.server import get_hostname_abbreviation
def execute():
for doctype in ["Server", "Database Server", "Proxy Server"]:
frappe.reload_doc("press", "doctype", doctype)
for doc in frappe.get_all(doctype, fields=["name", "hostname"]):
abbr = get_hostname_abbreviation(doc.hostname)
frappe.db.set_value(
doctype, doc.name, "hostname_abbreviation", abbr, update_modified=False
)