Sha256: 1028d9e29ff10e0b1fa7b8bc1ddd1f22b45e6baf795c65816583dc268a7ab6b2
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require 'optparse' module VagrantPlugins module VagrantWinRM class WinRMUpload < Vagrant.plugin('2', :command) def self.synopsis 'upload file or directory to machine via WinRM' end def execute opts = OptionParser.new do |o| o.banner = 'Usage: vagrant winrm-upload <source> <destination> [name]' end # Parse the options and return if we don't have any target. argv = parse_options opts return unless argv if argv.empty? || argv.length > 3 || argv.length < 2 raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp end source = argv[0] destination = argv[1] argv = argv.drop(2) # Execute the actual WinRM with_target_vms(argv, single_target: true) do |vm| raise Errors::ConfigurationError, { :communicator => vm.config.vm.communicator } if vm.config.vm.communicator != :winrm @logger.debug("Uploading #{source} to #{destination}") return vm.communicate.upload(source, destination) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-winrm-0.0.2 | lib/vagrant-winrm/commands/winrm_upload.rb |