fixes from @sethvargo comments.

This commit is contained in:
Matt Wrock 2015-06-05 00:11:06 -07:00
parent c60a020096
commit 1cd1033093
4 changed files with 13 additions and 14 deletions

View File

@ -45,16 +45,16 @@ module VagrantPlugins
raise Vagrant::Errors::VMNotCreatedError
end
if machine.config.vm.communicator != :winrm #|| !machine.provider.capability?(:winrm_info)
if machine.config.vm.communicator != :winrm
raise VagrantPlugins::CommunicatorWinRM::Errors::WinRMNotReady
end
if !options[:command].nil?
out_code = machine.communicate.execute options[:command]
out_code = machine.communicate.execute(options[:command])
if out_code == 0
machine.ui.detail("Command: #{options[:command]} executed succesfully with output code #{out_code}.")
end
break
next
end
ps_info = VagrantPlugins::CommunicatorWinRM::Helper.winrm_info(machine)
@ -63,7 +63,7 @@ module VagrantPlugins
# Extra arguments if we have any
ps_info[:extra_args] = options[:extra_args]
result = ready_ps_remoting_for machine, ps_info
result = ready_ps_remoting_for(machine, ps_info)
machine.ui.detail(
"Creating powershell session to #{ps_info[:host]}:#{ps_info[:port]}")
@ -73,7 +73,7 @@ module VagrantPlugins
@env.host.capability(:ps_client, ps_info)
ensure
if !result["PreviousTrustedHosts"].nil?
reset_ps_remoting_for machine, ps_info
reset_ps_remoting_for(machine, ps_info)
end
end
end

View File

@ -7,12 +7,12 @@ module VagrantPlugins
class Plugin < Vagrant.plugin("2")
name "ps command"
description <<-DESC
The ps command opens a remote powershell session to the
The ps command opens a remote PowerShell session to the
machine if it supports powershell remoting.
DESC
command("ps") do
require File.expand_path("../command", __FILE__)
require_relative "../command"
init!
Command
end
@ -21,8 +21,7 @@ module VagrantPlugins
def self.init!
return if defined?(@_init)
I18n.load_path << File.expand_path(
"templates/locales/command_ps.yml", Vagrant.source_root)
I18n.load_path << File.expand_path("templates/locales/command_ps.yml", Vagrant.source_root)
I18n.reload!
@_init = true
end

View File

@ -9,7 +9,7 @@ Vagrant::Util::SilenceWarnings.silence! do
require "winrm"
end
require "winrm-fs/file_manager"
require "winrm-fs"
module VagrantPlugins
module CommunicatorWinRM

View File

@ -1,16 +1,16 @@
en:
vagrant_ps:
detecting: |-
Detecting if a remote powershell connection can be made with the guest...
Detecting if a remote PowerShell connection can be made with the guest...
reseting: |-
Reseting WinRM TrustedHosts to their original value.
errors:
host_unsupported: |-
Your host does not support powershell. A remote powershell connection
Your host does not support PowerShell. A remote PowerShell connection
can only be made from a windows host.
ps_remoting_undetected: |-
Unable to establish a remote powershell connection with the guest.
Unable to establish a remote PowerShell connection with the guest.
Check if the firewall rules on the guest allow connections to the
windows remote management service.
Windows remote management service.