Skip to content

Commit b07a0c7

Browse files
authored
{Core} fix ValueError for getting clients.show_secrets_warning config in telemetry (#28387)
1 parent 60035ac commit b07a0c7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/azure-cli-core/azure/cli/core/telemetry.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -538,10 +538,12 @@ def _get_config():
538538

539539
@decorators.suppress_all_exceptions()
540540
def _get_secrets_warning_config():
541-
show_secrets_warning = _get_config().getboolean('clients', 'show_secrets_warning', fallback=None)
542-
if show_secrets_warning is None:
541+
from configparser import NoSectionError, NoOptionError
542+
try:
543+
show_secrets_warning = _get_config().getboolean('clients', 'show_secrets_warning')
544+
return 'on' if show_secrets_warning else 'off'
545+
except (NoSectionError, NoOptionError):
543546
return None
544-
return 'on' if show_secrets_warning else 'off'
545547

546548

547549
# internal utility functions

0 commit comments

Comments
 (0)