Skip to content

Commit

Permalink
Add winrm-transport to upload directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Iristyle committed May 19, 2015
1 parent 4338711 commit b2cb98d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions beaker.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'rsync', '~> 1.0.9'
s.add_runtime_dependency 'winrm', '~> 1.3.0'
s.add_runtime_dependency 'winrm-fs', '~> 0.1.0'
s.add_runtime_dependency 'winrm-transport', '~> 1.0.0'

This comment has been minimized.

Copy link
@ferventcoder

ferventcoder May 19, 2015

Seems these should go down under the next section.

This comment has been minimized.

Copy link
@ferventcoder

ferventcoder May 19, 2015

Even though there isn't really any difference right now, I think the heading is a placeholder for future work.


# Optional provisioner specific support
s.add_runtime_dependency 'rbvmomi', '~> 1.8'
Expand Down
10 changes: 5 additions & 5 deletions lib/beaker/winrm_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'timeout'
require 'winrm'
require 'winrm-fs'
require 'winrm/transport/file_transporter'

module Beaker
class WinrmConnection
Expand Down Expand Up @@ -149,11 +150,10 @@ def scp_to source, target, options = {}, dry_run = false

result = Result.new(@hostname, [source, target])
result.stdout = "\n"
file_manager = WinRM::FS::FileManager.new(@winrm)
file_manager.upload(source, target) do |bytes_copied, total_bytes, local_path, remote_path|
result.stdout << "\t#{bytes_copied}bytes of #{total_bytes}bytes copied\n"
end

file_transporter = WinRM::Transport::FileTransporter.new(@winrm)
upload_results = file_transporter.upload(source, target)
stats = upload_results.first[1]
result.stdout << " #{stats['xfered']} bytes uploaded in #{stats['chunks']} chunks\n"
# Setting these values allows reporting via result.log(test_name)
result.stdout << " Copied file #{source} to #{@hostname}:#{target}"

Expand Down

0 comments on commit b2cb98d

Please sign in to comment.