diff options
Diffstat (limited to 'lib/oxidized/input/cli.rb')
-rw-r--r-- | lib/oxidized/input/cli.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/oxidized/input/cli.rb b/lib/oxidized/input/cli.rb index d434e33..5ebfc50 100644 --- a/lib/oxidized/input/cli.rb +++ b/lib/oxidized/input/cli.rb @@ -51,6 +51,17 @@ module Oxidized def password re = /^Password/ @password or @password = re end + + def login + match_re = [@node.prompt] + match_re << @username if @username + match_re << @password if @password + until (match = expect(match_re)) == @node.prompt + cmd(@node.auth[:username], nil) if match == @username + cmd(@node.auth[:password], nil) if match == @password + match_re.delete match + end + end end end end |