From 7ff93ba16f561df39de388be25c1fe01565a51bd Mon Sep 17 00:00:00 2001 From: Alexander Presnyakov Date: Tue, 28 Oct 2025 17:13:46 +0000 Subject: [PATCH] Allow both mysql and mariadb as owners of the data dir --- cmapi/cmapi_server/controllers/endpoints.py | 2 +- cmapi/cmapi_server/invariant_checks.py | 12 ++++++++---- cmapi/requirements.in | 4 ++-- cmapi/requirements.txt | 4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/cmapi/cmapi_server/controllers/endpoints.py b/cmapi/cmapi_server/controllers/endpoints.py index 2642e80ca..528fa1154 100644 --- a/cmapi/cmapi_server/controllers/endpoints.py +++ b/cmapi/cmapi_server/controllers/endpoints.py @@ -453,7 +453,7 @@ class ConfigController: if diag: raise_422_error( module_logger, func_name, - f'Invariant checks failed. Details: {diag.strip()}', + f'Invariant checks failed. Details:\n{diag.strip()}', exc_info=False ) diff --git a/cmapi/cmapi_server/invariant_checks.py b/cmapi/cmapi_server/invariant_checks.py index bc08005e0..ba5e87511 100644 --- a/cmapi/cmapi_server/invariant_checks.py +++ b/cmapi/cmapi_server/invariant_checks.py @@ -2,8 +2,8 @@ import logging import os from typing import Optional, Tuple -from mr_kot import Runner, Status, check, check_all, fact, parametrize -from mr_kot_fs_validators import GroupIs, HasMode, IsDir, OwnerIs +from mr_kot import Runner, Status, any_of, check, check_all, fact, parametrize +from mr_kot_fs_validators import Exists, GroupIs, HasMode, IsDir, OwnerIs from cmapi_server import helpers from cmapi_server.constants import MCS_DATA_PATH @@ -76,6 +76,7 @@ REQUIRED_LOCAL_DIRS = [ def required_dirs_perms(dir: str) -> Tuple[Status, str]: status, ev = check_all( dir, + Exists(), IsDir(), HasMode('1755'), ) @@ -87,7 +88,10 @@ def required_dirs_ownership(dir: str) -> Tuple[Status, str]: # Check ownership only when not in containers status, ev = check_all( dir, - OwnerIs('mysql'), - GroupIs('mysql'), + Exists(), + # The correct owner is mysql, but i've seen mariadb as owner of the mountpoint, + # so we allow both + any_of(OwnerIs('mysql'), OwnerIs('mariadb')), + any_of(GroupIs('mysql'), GroupIs('mariadb')), ) return (status, ev) diff --git a/cmapi/requirements.in b/cmapi/requirements.in index 39bb49d24..4c6acc990 100644 --- a/cmapi/requirements.in +++ b/cmapi/requirements.in @@ -19,5 +19,5 @@ typer==0.15.2 pydantic==2.11.7 sentry-sdk==2.34.1 # Invariant checks -mr_kot==0.8.5 -mr_kot_fs_validators==0.1.0 \ No newline at end of file +mr_kot==0.9.2 +mr_kot_fs_validators==0.2.0 \ No newline at end of file diff --git a/cmapi/requirements.txt b/cmapi/requirements.txt index 2bedf3d1d..dcd444069 100644 --- a/cmapi/requirements.txt +++ b/cmapi/requirements.txt @@ -144,9 +144,9 @@ more-itertools==10.7.0 # cherrypy # jaraco-functools # jaraco-text -mr-kot==0.8.5 +mr-kot==0.9.2 # via -r requirements.in -mr-kot-fs-validators==0.1.0 +mr-kot-fs-validators==0.2.0 # via -r requirements.in multidict==6.6.4 # via