feat: add option to set chmod to socket

Change-Id: Ie1eca1c75d7e6676fbd736d3ecfb8f64c12b4bd4
Signed-off-by: Gabin Lanore <gabin.lanore@ovhcloud.com>
This commit is contained in:
Gabin Lanore
2025-03-03 16:23:20 +01:00
committed by Takashi Kajinami
parent c64d51c1d5
commit be7067daec
2 changed files with 9 additions and 1 deletions

View File

@@ -35,6 +35,8 @@ oslo_metrics_configs = [
' to send rpc related metrics'),
cfg.PortOpt('prometheus_port', default=3000,
help='Port number to expose metrics in prometheus format.'),
cfg.IntOpt('metrics_socket_perm', default=0o660,
help='Permission set to the unix domain socket file'),
]
cfg.CONF.register_opts(oslo_metrics_configs, group='oslo_metrics')
@@ -97,7 +99,7 @@ def main():
socket_path = cfg.CONF.oslo_metrics.metrics_socket_file
m = MetricsListener(socket_path)
try:
os.chmod(socket_path, 0o660) # nosec
os.chmod(socket_path, cfg.CONF.oslo_metrics.metrics_socket_perm)
except OSError:
LOG.error("Changing the mode of the file failed.... continuing")
mt = threading.Thread(target=m.serve)

View File

@@ -0,0 +1,6 @@
---
features:
- |
Introduced a new configuration option ``metrics_socket_perm`` under
the ``oslo_metrics`` group, allowing users to set custom permissions for
the Unix domain socket file.