# -*- coding: utf-8 -*-
# Copyright (c) 2021, JINGROW
# For license information, please see license.txt


import jingrow


def execute():
	jingrow.reload_pg("jcloud", "pagetype", "jerp_app")
	jingrow.reload_pg("jcloud", "pagetype", "jcloud_settings")
	jingrow.clear_cache()
	jcloud_settings = jingrow.get_pg("Jcloud Settings", "Jcloud Settings")
	if not jcloud_settings.get("cluster"):
		jcloud_settings.cluster = jingrow.db.get_value(
			"Root Domain", jcloud_settings.domain, "default_cluster"
		)
		jcloud_settings.save()
