mirror of
https://github.com/inspec/inspec
synced 2024-11-15 01:17:08 +00:00
bugfix: use instance variable, include winrm
This commit is contained in:
parent
b03db74798
commit
51fff9104b
1 changed files with 5 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
require 'shellwords'
|
require 'shellwords'
|
||||||
|
require 'winrm'
|
||||||
|
|
||||||
module Vulcano::Backends
|
module Vulcano::Backends
|
||||||
class SpecinfraHelper < Vulcano.backend(1)
|
class SpecinfraHelper < Vulcano.backend(1)
|
||||||
|
@ -127,7 +128,6 @@ module Vulcano::Backends
|
||||||
host = conf['host'].to_s
|
host = conf['host'].to_s
|
||||||
port = conf['port']
|
port = conf['port']
|
||||||
fail 'You must configure a target host.' if host.empty?
|
fail 'You must configure a target host.' if host.empty?
|
||||||
fail 'Port must be > 0 (not #{port})' unless port > 0
|
|
||||||
|
|
||||||
# SSL configuration
|
# SSL configuration
|
||||||
if conf['winrm_ssl']
|
if conf['winrm_ssl']
|
||||||
|
@ -147,20 +147,20 @@ module Vulcano::Backends
|
||||||
si.os = { family: 'windows' }
|
si.os = { family: 'windows' }
|
||||||
|
|
||||||
# validation
|
# validation
|
||||||
user = conf['user'].to_s
|
user = @conf['user'].to_s
|
||||||
pass = conf['password'].to_s
|
pass = @conf['password'].to_s
|
||||||
fail 'You must configure a WinRM user for login.' if user.empty?
|
fail 'You must configure a WinRM user for login.' if user.empty?
|
||||||
fail 'You must configure a WinRM password.' if pass.empty?
|
fail 'You must configure a WinRM password.' if pass.empty?
|
||||||
|
|
||||||
# create the connection
|
# create the connection
|
||||||
endpoint = winrm_url(conf)
|
endpoint = winrm_url(@conf)
|
||||||
winrm = ::WinRM::WinRMWebService.new(
|
winrm = ::WinRM::WinRMWebService.new(
|
||||||
endpoint,
|
endpoint,
|
||||||
:ssl,
|
:ssl,
|
||||||
user: user,
|
user: user,
|
||||||
pass: pass,
|
pass: pass,
|
||||||
basic_auth_only: true,
|
basic_auth_only: true,
|
||||||
no_ssl_peer_verification: conf['winrm_self_signed'],
|
no_ssl_peer_verification: @conf['winrm_self_signed'],
|
||||||
)
|
)
|
||||||
si.winrm = winrm
|
si.winrm = winrm
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue