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


import jingrow
from jingrow.utils.fixtures import sync_fixtures


def execute():
	sync_fixtures("jcloud")
	sites = jingrow.get_all(
		"Site",
		fields=["name", "status"],
		filters={"status": ("in", ("Suspended", "Inactive"))},
	)
	for site in sites:
		site = jingrow.get_pg("Site", site.name)
		proxy_status = {"Suspended": "suspended", "Inactive": "deactivated"}
		site.update_site_status_on_proxy(proxy_status[site.status], skip_reload=True)
