# Copyright (c) 2022, JINGROW
# For license information, please see license.txt

import jingrow


def execute():
	for machine in jingrow.get_all(
		"Virtual Machine", {"status": "Running"}, ["name", "series"]
	):
		server_type_map = {"f": "Server", "m": "Database Server", "n": "Proxy Server"}
		server = jingrow.db.get_value(
			server_type_map[machine.series], {"virtual_machine": machine.name}
		)
		jingrow.rename_pg("Virtual Machine", machine.name, server)
