From: John Mulligan Date: Wed, 2 Jul 2025 21:42:40 +0000 (-0400) Subject: mgr/smb: use a private constant for hidden value indicator X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=62347a15914ff5ca8557e4c121f8b55997132149;p=ceph.git mgr/smb: use a private constant for hidden value indicator 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 --- diff --git a/src/pybind/mgr/smb/resources.py b/src/pybind/mgr/smb/resources.py index 5351e9d4d41ad..89d83281d8ec2 100644 --- a/src/pybind/mgr/smb/resources.py +++ b/src/pybind/mgr/smb/resources.py @@ -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: