Skip to content

Commit ee5b419

Browse files
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 <[email protected]>
1 parent 173b538 commit ee5b419

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/pybind/mgr/smb/resources.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
LoginCategory,
2626
PasswordFilter,
2727
SMBClustering,
28+
SourceReferenceType,
2829
TLSCredentialType,
2930
UserGroupSourceType,
3031
)
@@ -466,6 +467,27 @@ def _customize_resource(rc: resourcelib.Resource) -> resourcelib.Resource:
466467
return rc
467468

468469

470+
@resourcelib.component()
471+
class TLSSource(_RBase):
472+
"""Represents TLS Certificates and Keys used to configure SMB related
473+
resources.
474+
"""
475+
476+
source_type: SourceReferenceType = SourceReferenceType.RESOURCE
477+
ref: str = ''
478+
479+
def validate(self) -> None:
480+
if not self.ref:
481+
raise ValueError('reference value must be specified')
482+
else:
483+
validation.check_id(self.ref)
484+
485+
@resourcelib.customize
486+
def _customize_resource(rc: resourcelib.Resource) -> resourcelib.Resource:
487+
rc.ref.quiet = True
488+
return rc
489+
490+
469491
@resourcelib.resource('ceph.smb.cluster')
470492
class Cluster(_RBase):
471493
"""Represents a cluster (instance) that is / should be present."""

0 commit comments

Comments
 (0)