diff --git a/CHANGELOG.md b/CHANGELOG.md index 4928c948c..0f8976e0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ BUG FIXES: - commands/reload: If `--provision` is specified, force provisioning. [GH-3657] - guests/redhat: Fix networking issues with CentOS. [GH-3649] - guests/windows: Human error if WinRM not in use to configure networks. [GH-3651] + - guests/windows: Puppet exit code 2 doesn't cause Windows to raise + an error. [GH-3677] - providers/docker: Show proper error message when on Linux. [GH-3654] - providers/docker: Proxy VM works properly even if default provider environmental variable set to "docker" [GH-3662] diff --git a/plugins/communicators/winrm/communicator.rb b/plugins/communicators/winrm/communicator.rb index 3bed39f72..cdb2bc7cf 100644 --- a/plugins/communicators/winrm/communicator.rb +++ b/plugins/communicators/winrm/communicator.rb @@ -57,14 +57,17 @@ module VagrantPlugins return 0 if command.empty? opts = { + command: command, + elevated: false, error_check: true, error_class: Errors::ExecutionError, error_key: :execution_error, - command: command, + good_exit: 0, shell: :powershell, - elevated: false }.merge(opts || {}) + opts[:good_exit] = Array(opts[:good_exit]) + if opts[:elevated] path = File.expand_path("../scripts/elevated_shell.ps1", __FILE__) command = Vagrant::Util::TemplateRenderer.render(path, options: { @@ -121,7 +124,8 @@ module VagrantPlugins def execution_output(output, opts) if opts[:shell] == :wql return output - elsif opts[:error_check] && output[:exitcode] != 0 + elsif opts[:error_check] && \ + !opts[:good_exit].include(output[:exitcode]) raise_execution_error(output, opts) end output[:exitcode]