Skip to content

Commit e10d65b

Browse files
authored
Merge pull request #171 from crepetl/fixes
winrm: hide password
2 parents 4a1ba1e + b71c554 commit e10d65b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/train/transports/winrm_connection.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Train::Transports::WinRM
2727
# host such as executing commands, transferring files, etc.
2828
#
2929
# @author Fletcher Nichol <[email protected]>
30-
class Connection < BaseConnection
30+
class Connection < BaseConnection # rubocop:disable Metrics/ClassLength
3131
attr_reader :hostname
3232
def initialize(options)
3333
super(options)
@@ -183,7 +183,9 @@ def session(retry_options = {})
183183
#
184184
# @api private
185185
def to_s
186-
"<#{options.inspect}>"
186+
options_to_print = @options.clone
187+
options_to_print[:password] = '<hidden>' if options_to_print.key?(:password)
188+
"#{@username}@#{@hostname}<#{options_to_print.inspect}>"
187189
end
188190

189191
class OS < OSCommon

0 commit comments

Comments
 (0)