Class: Promote::NodeShell::WinrmShell
Instance Attribute Summary
Attributes inherited from BaseShell
#node, #vault
Instance Method Summary
collapse
Methods inherited from BaseShell
#converge?, #initialize
Instance Method Details
#execute(command, ui = nil) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/promote/node_shell/winrm_shell.rb', line 18
def execute(command, ui = nil)
response = session.run_cmd(command) do |stdout, stderr|
ui.info(stdout) if stdout && ui
ui.error(stderr) if stderr && ui
end
response[:exitcode]
end
|
#session ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/promote/node_shell/winrm_shell.rb', line 6
def session
@session ||= begin
::WinRM::WinRMWebService.new(
"http://#{node.ipaddress}:5985/wsman",
:plaintext,
user: 'administrator',
pass: vault.admin_password,
basic_auth_only: true
)
end
end
|