Created
May 31, 2012 18:57
-
-
Save rtgibbons/2845418 to your computer and use it in GitHub Desktop.
Webistrano's hide_passwords() method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# replaces deployment passwords in the message by 'XXXXX' | |
def hide_passwords(message) | |
scrambled_message = message | |
# scramble non-prompt configs | |
deployment.stage.non_prompt_configurations.each do |config| | |
scrambled_message.gsub!(config.value, "XXXXXXXX") if ( config.name.match(/password/) && !config.value.to_s.strip.blank? ) | |
end | |
# scramble prompt configs | |
deployment.prompt_config.each do |k, v| | |
scrambled_message.gsub!(v, "XXXXXXXX") if ( k.to_s.match(/password/) && !v.to_s.strip.blank?) | |
end | |
scrambled_message | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment