Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from jdantonio/master
Browse files Browse the repository at this point in the history
Better support for options to WinRM::HTTP::HttpTransport
  • Loading branch information
zenchild committed Feb 19, 2013
2 parents 6cc8d57 + 645ad11 commit cae261f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.0.2
4 changes: 2 additions & 2 deletions capistrano_winrm.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ Gem::Specification.new do |s|
s.extra_rdoc_files = %w(README)

s.required_ruby_version = '>= 1.9.0'
s.add_runtime_dependency 'capistrano', '~> 2.5.18'
s.add_runtime_dependency 'winrm', '~> 1.0.0'
s.add_runtime_dependency 'capistrano', '~> 2.14.1'
s.add_runtime_dependency 'winrm', '~> 1.1.2'
end
19 changes: 15 additions & 4 deletions lib/winrm_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize(server, opts)
def [](key)
@int_hash[key.to_sym]
end

def []=(key, value)
@int_hash[key.to_sym] = value
end
Expand Down Expand Up @@ -50,13 +50,24 @@ def on_close; self; end
def establish_winrm(opts)
http_method = ( server.port.to_s=~/(443|5986)/ ? 'https' : 'http' )
endpoint = "#{http_method}://#{server}/wsman"

transport_opts = {}
transport_opts[:disable_sspi] = opts[:winrm_disable_sspi] unless opts[:winrm_disable_sspi].nil?
transport_opts[:basic_auth_only] = opts[:winrm_basic_auth_only] unless opts[:winrm_basic_auth_only].nil?

if opts[:winrm_krb5_realm]
inst = WinRM::WinRMWebService.new(endpoint, :kerberos, :realm => opts[:winrm_krb5_realm])
transport_opts[:realm] = opts[:winrm_krb5_realm]
inst = WinRM::WinRMWebService.new(endpoint, :kerberos, transport_opts)
else
unless opts[:winrm_ssl_ca_store]
inst = WinRM::WinRMWebService.new(endpoint, :plaintext, :user => opts[:winrm_user], :pass => opts[:winrm_password])
transport_opts[:user] = opts[:winrm_user]
transport_opts[:pass] = opts[:winrm_password]
inst = WinRM::WinRMWebService.new(endpoint, :plaintext, transport_opts)
else
inst = WinRM::WinRMWebService.new(endpoint, :ssl, :user => opts[:winrm_user], :pass => opts[:winrm_password], :ca_trust_path => opts[:winrm_ssl_ca_store])
transport_opts[:user] = opts[:winrm_user]
transport_opts[:pass] = opts[:winrm_password]
transport_opts[:ca_trust_path] = opts[:winrm_ssl_ca_store]
inst = WinRM::WinRMWebService.new(endpoint, :ssl, transport_opts)
end
end
inst
Expand Down

0 comments on commit cae261f

Please sign in to comment.