mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Fixed deploy command
This commit is contained in:
+31
-3
@@ -1,10 +1,38 @@
|
||||
from django.core.checks import register, Info
|
||||
from django.core.checks import register, Info, Warning
|
||||
from django.conf import settings
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from modoboa.core.utils import generate_rsa_private_key
|
||||
|
||||
|
||||
W001 = Warning(
|
||||
_(
|
||||
"You have USE_TZ set to False, this may result in issues during "
|
||||
"transitions between summer/winter time (ie the same local time occuring "
|
||||
"twice due to clock change)."
|
||||
),
|
||||
hint=_("Set `USE_TZ = True` in settings.py"),
|
||||
id="modoboa.W001",
|
||||
)
|
||||
|
||||
|
||||
@register(deploy=True)
|
||||
def generate_rsa_private_key_check(app_configs, **kwargs):
|
||||
def check_use_tz_enabled(app_configs, **kwargs):
|
||||
"""Ensure USE_TZ is enabled in settings.py
|
||||
|
||||
When USE_TZ is enabled all date/times are stored in UTC.
|
||||
Fixes #1086 - https://github.com/modoboa/modoboa/issues/1086
|
||||
"""
|
||||
errors = []
|
||||
if not settings.USE_TZ:
|
||||
errors.append(W001)
|
||||
return errors
|
||||
|
||||
|
||||
@register(deploy=True)
|
||||
def check_rsa_private_key_exists(app_configs, **kwargs):
|
||||
"""
|
||||
Ensure an RSA private key exists to enable OIDC.
|
||||
"""
|
||||
if generate_rsa_private_key(settings.BASE_DIR):
|
||||
return Info("Generated the RSA key for OIDC.")
|
||||
return Info("An RSA private key has been generated for OIDC.")
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Import these to force registration of checks
|
||||
from . import settings_checks # NOQA:F401
|
||||
@@ -1,26 +0,0 @@
|
||||
from django.conf import settings
|
||||
from django.core.checks import Warning, register
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
W001 = Warning(
|
||||
_(
|
||||
"You have USE_TZ set to False, this may result in issues during "
|
||||
"transitions between summer/winter time (ie the same local time occuring "
|
||||
"twice due to clock change)."
|
||||
),
|
||||
hint=_("Set `USE_TZ = True` in settings.py"),
|
||||
id="modoboa.W001",
|
||||
)
|
||||
|
||||
|
||||
@register(deploy=True)
|
||||
def check_use_tz_enabled(app_configs, **kwargs):
|
||||
"""Ensure USE_TZ is enabled in settings.py
|
||||
|
||||
When USE_TZ is enabled all date/times are stored in UTC.
|
||||
Fixes #1086 - https://github.com/modoboa/modoboa/issues/1086
|
||||
"""
|
||||
errors = []
|
||||
if not settings.USE_TZ:
|
||||
errors.append(W001)
|
||||
return errors
|
||||
@@ -11,7 +11,6 @@ from django.utils.translation import gettext as _
|
||||
|
||||
from modoboa.core.extensions import exts_pool
|
||||
from modoboa.lib.api_client import ModoAPIClient
|
||||
from . import models
|
||||
|
||||
|
||||
def parse_map_file(path):
|
||||
@@ -28,6 +27,8 @@ def parse_map_file(path):
|
||||
|
||||
def check_for_updates():
|
||||
"""Check if a new version of Modoboa is available."""
|
||||
from . import models
|
||||
|
||||
local_config = models.LocalConfig.objects.first()
|
||||
client = ModoAPIClient()
|
||||
extensions = exts_pool.list_all()
|
||||
|
||||
Reference in New Issue
Block a user