update DOCTYPES to PAGETYPES
This commit is contained in:
parent
e4645407fc
commit
3f6f130113
@ -23,7 +23,7 @@ from jcloude.utils import has_role
|
|||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from jingrow.model.meta import Meta
|
from jingrow.model.meta import Meta
|
||||||
|
|
||||||
ALLOWED_DOCTYPES = [
|
ALLOWED_PAGETYPES = [
|
||||||
"Site",
|
"Site",
|
||||||
"Site App",
|
"Site App",
|
||||||
"Site Domain",
|
"Site Domain",
|
||||||
@ -483,7 +483,7 @@ def is_allowed_table_field(pagetype, field):
|
|||||||
|
|
||||||
|
|
||||||
def check_permissions(pagetype):
|
def check_permissions(pagetype):
|
||||||
if pagetype not in ALLOWED_DOCTYPES:
|
if pagetype not in ALLOWED_PAGETYPES:
|
||||||
raise_not_permitted()
|
raise_not_permitted()
|
||||||
|
|
||||||
if not hasattr(jingrow.local, "team") or not jingrow.local.team():
|
if not hasattr(jingrow.local, "team") or not jingrow.local.team():
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import jingrow
|
|||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
DOCTYPES = ["Server", "Database Server"]
|
PAGETYPES = ["Server", "Database Server"]
|
||||||
for pagetype in DOCTYPES:
|
for pagetype in PAGETYPES:
|
||||||
server_names = jingrow.get_all(
|
server_names = jingrow.get_all(
|
||||||
pagetype,
|
pagetype,
|
||||||
{"status": ("!=", "Archived"), "virtual_machine": ("is", "set")},
|
{"status": ("!=", "Archived"), "virtual_machine": ("is", "set")},
|
||||||
|
|||||||
@ -115,7 +115,7 @@ if TYPE_CHECKING:
|
|||||||
from jcloude.jcloude.pagetype.site_domain.site_domain import SiteDomain
|
from jcloude.jcloude.pagetype.site_domain.site_domain import SiteDomain
|
||||||
from jcloude.jcloude.pagetype.tls_certificate.tls_certificate import TLSCertificate
|
from jcloude.jcloude.pagetype.tls_certificate.tls_certificate import TLSCertificate
|
||||||
|
|
||||||
DOCTYPE_SERVER_TYPE_MAP = {
|
PAGETYPE_SERVER_TYPE_MAP = {
|
||||||
"Server": "Application",
|
"Server": "Application",
|
||||||
"Database Server": "Database",
|
"Database Server": "Database",
|
||||||
"Proxy Server": "Proxy",
|
"Proxy Server": "Proxy",
|
||||||
@ -934,7 +934,7 @@ class Site(Page, TagHelpers):
|
|||||||
mountpoint = server.guess_data_disk_mountpoint()
|
mountpoint = server.guess_data_disk_mountpoint()
|
||||||
free_space = server.free_space(mountpoint)
|
free_space = server.free_space(mountpoint)
|
||||||
if (diff := free_space - space_required) <= 0:
|
if (diff := free_space - space_required) <= 0:
|
||||||
msg = f"Insufficient estimated space on {DOCTYPE_SERVER_TYPE_MAP[server.pagetype]} server to {purpose}. Required: {human_readable(space_required)}, Available: {human_readable(free_space)} (Need {human_readable(abs(diff))} more)."
|
msg = f"Insufficient estimated space on {PAGETYPE_SERVER_TYPE_MAP[server.pagetype]} server to {purpose}. Required: {human_readable(space_required)}, Available: {human_readable(free_space)} (Need {human_readable(abs(diff))} more)."
|
||||||
if server.public and not no_increase:
|
if server.public and not no_increase:
|
||||||
self.try_increasing_disk(server, mountpoint, diff, msg)
|
self.try_increasing_disk(server, mountpoint, diff, msg)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user