Merge pull request #6503 from Wenzel/expose_packer_http_addr_shell_local
Expose PACKER_HTTP_ADDR environment variable for shell-local
This commit is contained in:
commit
9c2f44be83
|
@ -9,6 +9,7 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/hashicorp/packer/common"
|
||||||
commonhelper "github.com/hashicorp/packer/helper/common"
|
commonhelper "github.com/hashicorp/packer/helper/common"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/template/interpolate"
|
"github.com/hashicorp/packer/template/interpolate"
|
||||||
|
@ -165,6 +166,12 @@ func createFlattenedEnvVars(config *Config) (string, error) {
|
||||||
envVars["PACKER_BUILD_NAME"] = fmt.Sprintf("%s", config.PackerBuildName)
|
envVars["PACKER_BUILD_NAME"] = fmt.Sprintf("%s", config.PackerBuildName)
|
||||||
envVars["PACKER_BUILDER_TYPE"] = fmt.Sprintf("%s", config.PackerBuilderType)
|
envVars["PACKER_BUILDER_TYPE"] = fmt.Sprintf("%s", config.PackerBuilderType)
|
||||||
|
|
||||||
|
// expose PACKER_HTTP_ADDR
|
||||||
|
httpAddr := common.GetHTTPAddr()
|
||||||
|
if httpAddr != "" {
|
||||||
|
envVars["PACKER_HTTP_ADDR"] = fmt.Sprintf("%s", httpAddr)
|
||||||
|
}
|
||||||
|
|
||||||
// interpolate environment variables
|
// interpolate environment variables
|
||||||
config.Ctx.Data = &EnvVarsTemplate{
|
config.Ctx.Data = &EnvVarsTemplate{
|
||||||
WinRMPassword: getWinRMPassword(config.PackerBuildName),
|
WinRMPassword: getWinRMPassword(config.PackerBuildName),
|
||||||
|
|
|
@ -184,6 +184,13 @@ commonly useful environmental variables:
|
||||||
machine that the script is running on. This is useful if you want to run
|
machine that the script is running on. This is useful if you want to run
|
||||||
only certain parts of the script on systems built with certain builders.
|
only certain parts of the script on systems built with certain builders.
|
||||||
|
|
||||||
|
- `PACKER_HTTP_ADDR` If using a builder that provides an http server for file
|
||||||
|
transfer (such as hyperv, parallels, qemu, virtualbox, and vmware), this
|
||||||
|
will be set to the address. You can use this address in your provisioner to
|
||||||
|
download large files over http. This may be useful if you're experiencing
|
||||||
|
slower speeds using the default file provisioner. A file provisioner using
|
||||||
|
the `winrm` communicator may experience these types of difficulties.
|
||||||
|
|
||||||
## Safely Writing A Script
|
## Safely Writing A Script
|
||||||
|
|
||||||
Whether you use the `inline` option, or pass it a direct `script` or `scripts`,
|
Whether you use the `inline` option, or pass it a direct `script` or `scripts`,
|
||||||
|
|
Loading…
Reference in New Issue