]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: introducing nobody/nogroup constants 57535/head
authorRedouane Kachach <rkachach@ibm.com>
Thu, 27 Jun 2024 10:11:55 +0000 (12:11 +0200)
committerRedouane Kachach <rkachach@ibm.com>
Tue, 9 Jul 2024 13:27:33 +0000 (15:27 +0200)
Signed-off-by: Redouane Kachach <rkachach@ibm.com>
src/cephadm/cephadmlib/constants.py
src/cephadm/cephadmlib/daemons/custom.py
src/cephadm/cephadmlib/daemons/mgmt_gateway.py
src/cephadm/cephadmlib/daemons/monitoring.py
src/cephadm/cephadmlib/daemons/tracing.py

index 41add9fd10dac46e84ea24b1aa642475fe325c76..b0a989df620541497107e622a0e7e1155f7c2478 100644 (file)
@@ -50,3 +50,5 @@ DEFAULT_RETRY = 15
 DATEFMT = '%Y-%m-%dT%H:%M:%S.%fZ'
 QUIET_LOG_LEVEL = 9  # DEBUG is 10, so using 9 to be lower level than DEBUG
 NO_DEPRECATED = False
+UID_NOBODY = 65534
+GID_NOGROUP = 65534
index e833c80c9a5d7afdc15b45383ee17b5171d2910e..76b4162e2893d3ade29305e38402f6bf6a818168 100644 (file)
@@ -15,6 +15,7 @@ from ..deploy import DeploymentType
 from ..deployment_utils import to_deployment_container
 from ..file_utils import write_new, makedirs
 from ..net_utils import EndPoint
+from ..constants import UID_NOBODY, GID_NOGROUP
 
 
 logger = logging.getLogger()
@@ -43,8 +44,8 @@ class CustomContainer(ContainerDaemonForm):
 
         # config-json options
         self.entrypoint = dict_get(config_json, 'entrypoint')
-        self.uid = dict_get(config_json, 'uid', 65534)  # nobody
-        self.gid = dict_get(config_json, 'gid', 65534)  # nobody
+        self.uid = dict_get(config_json, 'uid', UID_NOBODY)
+        self.gid = dict_get(config_json, 'gid', GID_NOGROUP)
         self.volume_mounts = dict_get(config_json, 'volume_mounts', {})
         self.args = dict_get(config_json, 'args', [])
         self.envs = dict_get(config_json, 'envs', [])
index f3b28bcccc720cbf77b020e7b0f2ba203cf7c03e..93dfc275c41c9d2822afca48f5aa66e2ba2363be 100644 (file)
@@ -11,7 +11,7 @@ from ..context_getters import fetch_configs
 from ..daemon_form import register as register_daemon_form
 from ..daemon_identity import DaemonIdentity
 from ..deployment_utils import to_deployment_container
-from ..constants import DEFAULT_NGINX_IMAGE
+from ..constants import DEFAULT_NGINX_IMAGE, UID_NOBODY, GID_NOGROUP
 from ..data_utils import dict_get, is_fsid
 from ..file_utils import populate_files, makedirs, recursive_chown
 from ..exceptions import Error
@@ -90,7 +90,7 @@ class MgmtGateway(ContainerDaemonForm):
         return to_deployment_container(ctx, ctr)
 
     def uid_gid(self, ctx: CephadmContext) -> Tuple[int, int]:
-        return 65534, 65534  # nobody, nobody
+        return UID_NOBODY, GID_NOGROUP
 
     def get_daemon_args(self) -> List[str]:
         return []
index 55e6a9458f0ffbf6681170a396a63f79286811e2..fca4da406e5deb01d80a2fafb8a76f2a713e6d0d 100644 (file)
@@ -10,6 +10,8 @@ from ..constants import (
     DEFAULT_NODE_EXPORTER_IMAGE,
     DEFAULT_PROMETHEUS_IMAGE,
     DEFAULT_PROMTAIL_IMAGE,
+    UID_NOBODY,
+    GID_NOGROUP,
 )
 from ..container_daemon_form import ContainerDaemonForm, daemon_to_container
 from ..container_types import CephContainer, extract_uid_gid
@@ -170,7 +172,7 @@ class Monitoring(ContainerDaemonForm):
         if daemon_type == 'prometheus':
             uid, gid = extract_uid_gid(ctx, file_path='/etc/prometheus')
         elif daemon_type == 'node-exporter':
-            uid, gid = 65534, 65534
+            uid, gid = UID_NOBODY, GID_NOGROUP
         elif daemon_type == 'grafana':
             uid, gid = extract_uid_gid(ctx, file_path='/var/lib/grafana')
         elif daemon_type == 'loki':
index 4d4fecacbb0f9b9b67e153645a2b25df6a76bb59..365458a9c57b441b16009848d799020ece56f84c 100644 (file)
@@ -15,6 +15,7 @@ from ..context_getters import fetch_configs
 from ..daemon_form import register as register_daemon_form
 from ..daemon_identity import DaemonIdentity
 from ..deployment_utils import to_deployment_container
+from ..constants import UID_NOBODY, GID_NOGROUP
 
 
 logger = logging.getLogger()
@@ -87,7 +88,7 @@ class Tracing(ContainerDaemonForm):
         return to_deployment_container(ctx, ctr)
 
     def uid_gid(self, ctx: CephadmContext) -> Tuple[int, int]:
-        return 65534, 65534
+        return UID_NOBODY, GID_NOGROUP
 
     def get_daemon_args(self) -> List[str]:
         return self.components[self.identity.daemon_type].get(