From 8ddbb791a12e7ad57d295a98c554e6c411b59b53 Mon Sep 17 00:00:00 2001 From: DanHam Date: Mon, 5 Aug 2019 13:47:41 +0100 Subject: [PATCH 1/2] Fix typo --- post-processor/shell-local/post-processor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post-processor/shell-local/post-processor.go b/post-processor/shell-local/post-processor.go index 3d7131427..e23d31648 100644 --- a/post-processor/shell-local/post-processor.go +++ b/post-processor/shell-local/post-processor.go @@ -47,7 +47,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact } // Force shell-local pp to keep the input artifact, because otherwise we'll - // lose it instead of being able to pass it through. If oyu want to delete + // lose it instead of being able to pass it through. If you want to delete // the input artifact for a shell local pp, use the artifice pp to create a // new artifact return artifact, true, true, retErr From 66b5b9f8c5624a59bb3873b33b11fd5299961ca6 Mon Sep 17 00:00:00 2001 From: DanHam Date: Mon, 5 Aug 2019 15:47:01 +0100 Subject: [PATCH 2/2] Fix incorrect `execute_command` defaults in shell-local pp docs --- .../docs/post-processors/shell-local.html.md | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/website/source/docs/post-processors/shell-local.html.md b/website/source/docs/post-processors/shell-local.html.md index 0d7c1f4ee..c24d00463 100644 --- a/website/source/docs/post-processors/shell-local.html.md +++ b/website/source/docs/post-processors/shell-local.html.md @@ -68,18 +68,29 @@ Optional parameters: it is necessary below. - `execute_command` (array of strings) - The command used to execute the - script. By default this is `["/bin/sh", "-c", "{{.Vars}}", "{{.Script}}"]` - on unix and `["cmd", "/c", "{{.Vars}}", "{{.Script}}"]` on windows. This is - treated as a [template engine](/docs/templates/engine.html). There are two - available variables: `Script`, which is the path to the script to run, and - `Vars`, which is the list of `environment_vars`, if configured. If you - choose to set this option, make sure that the first element in the array is - the shell program you want to use (for example, "sh" or - "/usr/local/bin/zsh" or even "powershell.exe" although anything other than - a flavor of the shell command language is not explicitly supported and may - be broken by assumptions made within Packer). It's worth noting that if you - choose to try to use shell-local for Powershell or other Windows commands, - the environment variables will not be set properly for your environment. + script. By default, on *nix systems this is: + + ``` + ["/bin/sh", "-c", "{{.Vars}} {{.Script}}"] + ``` + + While on Windows, `execute_command` defaults to: + + ``` + ["cmd", "/V", "/C", "{{.Vars}}", "call", "{{.Script}}"] + ``` + + This is treated as a [template engine](/docs/templates/engine.html). + There are two available variables: `Script`, which is the path to the + script to run, and `Vars`, which is the list of `environment_vars`, if + configured. If you choose to set this option, make sure that the first + element in the array is the shell program you want to use (for example, + "sh" or "/usr/local/bin/zsh" or even "powershell.exe" although anything + other than a flavor of the shell command language is not explicitly + supported and may be broken by assumptions made within Packer). It's + worth noting that if you choose to try to use shell-local for + Powershell or other Windows commands, the environment variables will + not be set properly for your environment. For backwards compatibility, `execute_command` will accept a string instead of an array of strings. If a single string or an array of strings with only