Permalink
Browse files

Merge pull request #4 from jdantonio/master

Better support for options to WinRM::HTTP::HttpTransport
  • Loading branch information...
2 parents 6cc8d57 + 645ad11 commit cae261fdfb13f70f42f14e37f6bdbd7a11c1df9a @zenchild committed Feb 19, 2013
Showing with 18 additions and 7 deletions.
  1. +1 −1 VERSION
  2. +2 −2 capistrano_winrm.gemspec
  3. +15 −4 lib/winrm_connection.rb
View
@@ -1 +1 @@
-1.0.1
+1.0.2
@@ -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
@@ -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
@@ -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

0 comments on commit cae261f

Please sign in to comment.