]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/smb: use a private constant for hidden value indicator
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 2 Jul 2025 21:42:40 +0000 (17:42 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 12 Aug 2025 14:24:49 +0000 (10:24 -0400)
When the password filter hides a value we replace it with a string
of asterisks - indicating that there was a value here. Move it
to a constant so it can be reused later.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/smb/resources.py

index 5351e9d4d41ad4d0895f67639f035aab63e86c58..89d83281d8ec22723bed3042a230292d3e3fe988 100644 (file)
@@ -31,6 +31,8 @@ from .utils import checked
 
 ConversionOp = Tuple[PasswordFilter, PasswordFilter]
 
+_MASKED = '*' * 16
+
 
 def _get_intent(data: Simplified) -> Intent:
     """Helper function that returns the intent value from a data dict."""
@@ -644,7 +646,7 @@ def _password_convert(pvalue: str, operation: ConversionOp) -> str:
     if operation == (PasswordFilter.NONE, PasswordFilter.BASE64):
         pvalue = base64.b64encode(pvalue.encode("utf8")).decode("utf8")
     elif operation == (PasswordFilter.NONE, PasswordFilter.HIDDEN):
-        pvalue = "*" * 16
+        pvalue = _MASKED
     elif operation == (PasswordFilter.BASE64, PasswordFilter.NONE):
         pvalue = base64.b64decode(pvalue.encode("utf8")).decode("utf8")
     else: