tweak docs; change to
This commit is contained in:
parent
0f6d1beccf
commit
6bc5a95c3a
@ -44,7 +44,7 @@ var FuncGens = map[string]interface{}{
|
|||||||
"consul_key": funcGenConsul,
|
"consul_key": funcGenConsul,
|
||||||
"vault": funcGenVault,
|
"vault": funcGenVault,
|
||||||
"sed": funcGenSed,
|
"sed": funcGenSed,
|
||||||
"generated": funcGenGenerated,
|
"build": funcGenBuild,
|
||||||
|
|
||||||
"replace": replace,
|
"replace": replace,
|
||||||
"replace_all": replace_all,
|
"replace_all": replace_all,
|
||||||
@ -164,7 +164,7 @@ func funcGenTemplateDir(ctx *Context) interface{} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func funcGenGenerated(ctx *Context) interface{} {
|
func funcGenBuild(ctx *Context) interface{} {
|
||||||
return func(s string) (string, error) {
|
return func(s string) (string, error) {
|
||||||
if data, ok := ctx.Data.(map[interface{}]interface{}); ok {
|
if data, ok := ctx.Data.(map[interface{}]interface{}); ok {
|
||||||
// PlaceholderData has been passed into generator, so if the given
|
// PlaceholderData has been passed into generator, so if the given
|
||||||
@ -184,7 +184,7 @@ func funcGenGenerated(ctx *Context) interface{} {
|
|||||||
return "", fmt.Errorf("loaded data, but couldnt find %s in it.", s)
|
return "", fmt.Errorf("loaded data, but couldnt find %s in it.", s)
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", fmt.Errorf("Error validating computed variable: the given "+
|
return "", fmt.Errorf("Error validating build variable: the given "+
|
||||||
"variable %s will not be passed into your plugin.", s)
|
"variable %s will not be passed into your plugin.", s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
website/source/docs/templates/engine.html.md
vendored
21
website/source/docs/templates/engine.html.md
vendored
@ -62,22 +62,27 @@ Here is a full list of the available functions for reference.
|
|||||||
each function will behave.
|
each function will behave.
|
||||||
- `env` - Returns environment variables. See example in [using home
|
- `env` - Returns environment variables. See example in [using home
|
||||||
variable](/docs/templates/user-variables.html#using-home-variable)
|
variable](/docs/templates/user-variables.html#using-home-variable)
|
||||||
- `generated` - This engine will allow you to access special variables that
|
- `build` - This engine will allow you to access special variables that
|
||||||
provide connection information and basic instance state information.
|
provide connection information and basic instance state information.
|
||||||
Usage example:
|
Usage example:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "shell-local",
|
"type": "shell-local",
|
||||||
"environment_vars": ["TESTVAR={{ generated `PACKER_RUN_UUID`}}"],
|
"environment_vars": ["TESTVAR={{ build `PackerRunUUID`}}"],
|
||||||
"inline": ["echo $TESTVAR"]
|
"inline": ["echo $TESTVAR"]
|
||||||
},
|
},
|
||||||
```
|
```
|
||||||
Valid variables to request are: "ID", "Host", "Port", "User", "Password",
|
Valid variables to request are: "InstanceID", "CommunicatorHost",
|
||||||
"ConnType", "PACKER_RUN_UUID", "SSHPublicKey", "SSHPrivateKey", and
|
"CommunicatorPort", "CommunicatorUser", "CommunicatorPassword", "ConnType",
|
||||||
"WinRMPassword", though obviously depending on which communicator you are
|
"PackerRunUUID", "CommunicatorPublicKey", and "CommunicatorPrivateKey".
|
||||||
using, some of these values may be empty. ID represents the vm being
|
Depending on which communicator you are using, some of these values may be
|
||||||
provisioned. For example, in Amazon it is the instance id; in digitalocean,
|
empty -- for example, the public and private keys are unique to the SSH
|
||||||
it is the droplet id; in Vmware, it is the vm name.
|
communicator. InstanceID represents the vm being provisioned. For example,
|
||||||
|
in Amazon it is the instance id; in digitalocean, it is the droplet id; in
|
||||||
|
Vmware, it is the vm name.
|
||||||
|
|
||||||
|
For backwards compatability, `WinRMPassword` is also available through this
|
||||||
|
engine, though it is no different than using the more general `Password`.
|
||||||
|
|
||||||
This function is only for use within _provisioners_, and does not yet work
|
This function is only for use within _provisioners_, and does not yet work
|
||||||
if the provisioners are being used in conjunction with our chroot builders
|
if the provisioners are being used in conjunction with our chroot builders
|
||||||
|
Loading…
x
Reference in New Issue
Block a user