From ee5b41981a43da8cff889c80b001540538b08af6 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 2 Jul 2025 17:45:42 -0400 Subject: [PATCH] mgr/smb: add a new tls source component resource Add a new resource component for referencing a tls credential resource. This works pretty much like the join auth resource in that a cluster refers to a tls credential resource by name - avoiding having to have potentially sensitive info stored in the cluster resource. Signed-off-by: John Mulligan --- src/pybind/mgr/smb/resources.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/pybind/mgr/smb/resources.py b/src/pybind/mgr/smb/resources.py index 1320619650bf9..5c9149cd0267e 100644 --- a/src/pybind/mgr/smb/resources.py +++ b/src/pybind/mgr/smb/resources.py @@ -25,6 +25,7 @@ from .enums import ( LoginCategory, PasswordFilter, SMBClustering, + SourceReferenceType, TLSCredentialType, UserGroupSourceType, ) @@ -466,6 +467,27 @@ class ClusterBindIP(_RBase): return rc +@resourcelib.component() +class TLSSource(_RBase): + """Represents TLS Certificates and Keys used to configure SMB related + resources. + """ + + source_type: SourceReferenceType = SourceReferenceType.RESOURCE + ref: str = '' + + def validate(self) -> None: + if not self.ref: + raise ValueError('reference value must be specified') + else: + validation.check_id(self.ref) + + @resourcelib.customize + def _customize_resource(rc: resourcelib.Resource) -> resourcelib.Resource: + rc.ref.quiet = True + return rc + + @resourcelib.resource('ceph.smb.cluster') class Cluster(_RBase): """Represents a cluster (instance) that is / should be present.""" -- 2.39.5