Class: VagrantWindows::Communication::WinRMShell
- Inherits:
-
Object
- Object
- VagrantWindows::Communication::WinRMShell
- Includes:
- Vagrant::Util::Retryable
- Defined in:
- lib/vagrant-windows/communication/winrmshell.rb
Constant Summary collapse
- @@exceptions_to_retry_on =
These are the exceptions that we retry because they represent errors that are generally fixed from a retry and don’t necessarily represent immediate failure cases.
[ HTTPClient::KeepAliveDisconnected, WinRM::WinRMHTTPTransportError, Errno::EACCES, Errno::EADDRINUSE, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ENETUNREACH, Errno::EHOSTUNREACH, Timeout::Error ]
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#max_tries ⇒ Object
readonly
Returns the value of attribute max_tries.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#timeout_in_seconds ⇒ Object
readonly
Returns the value of attribute timeout_in_seconds.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #cmd(command, &block) ⇒ Object
-
#initialize(host, username, password, options = {}) ⇒ WinRMShell
constructor
A new instance of WinRMShell.
- #powershell(command, &block) ⇒ Object
- #wql(query) ⇒ Object
Constructor Details
#initialize(host, username, password, options = {}) ⇒ WinRMShell
Returns a new instance of WinRMShell.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 36 def initialize(host, username, password, = {}) @logger = Log4r::Logger.new("vagrant_windows::communication::winrmshell") @logger.debug("initializing WinRMShell") @host = host @port = [:port] || 5985 @username = username @password = password @timeout_in_seconds = [:timeout_in_seconds] || 60 @max_tries = [:max_tries] || 20 end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
31 32 33 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 31 def host @host end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
28 29 30 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 28 def logger @logger end |
#max_tries ⇒ Object (readonly)
Returns the value of attribute max_tries.
34 35 36 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 34 def max_tries @max_tries end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
30 31 32 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 30 def password @password end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
32 33 34 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 32 def port @port end |
#timeout_in_seconds ⇒ Object (readonly)
Returns the value of attribute timeout_in_seconds.
33 34 35 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 33 def timeout_in_seconds @timeout_in_seconds end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
29 30 31 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 29 def username @username end |
Instance Method Details
#cmd(command, &block) ⇒ Object
52 53 54 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 52 def cmd(command, &block) execute_shell(command, :cmd, &block) end |
#powershell(command, &block) ⇒ Object
48 49 50 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 48 def powershell(command, &block) execute_shell(command, :powershell, &block) end |
#wql(query) ⇒ Object
56 57 58 |
# File 'lib/vagrant-windows/communication/winrmshell.rb', line 56 def wql(query) execute_wql(query) end |