def filter_text(text): """ Replace passwords with [PROTECTED] and remove shell.py placeholders """ from resource_management.core.shell import PLACEHOLDERS_TO_STR for unprotected_string, protected_string in Logger.sensitive_strings.iteritems(): text = text.replace(unprotected_string, protected_string) for placeholder in PLACEHOLDERS_TO_STR.keys(): text = text.replace(placeholder, '') return text