add BuilderDataCommonKeys var to see what common keys a builder can return
This commit is contained in:
parent
10e5d952ac
commit
ab54f48247
|
@ -42,6 +42,24 @@ type ProvisionHook struct {
|
|||
Provisioners []*HookedProvisioner
|
||||
}
|
||||
|
||||
// BuilderDataCommonKeys is the list of common keys that all builder will
|
||||
// return
|
||||
var BuilderDataCommonKeys = []string{
|
||||
"ID",
|
||||
"Host",
|
||||
"Port",
|
||||
"User",
|
||||
"Password",
|
||||
"ConnType",
|
||||
"PackerRunUUID",
|
||||
"PackerHTTPPort",
|
||||
"PackerHTTPIP",
|
||||
"PackerHTTPAddr",
|
||||
"SSHPublicKey",
|
||||
"SSHPrivateKey",
|
||||
"WinRMPassword",
|
||||
}
|
||||
|
||||
// Provisioners interpolate most of their fields in the prepare stage; this
|
||||
// placeholder map helps keep fields that are only generated at build time from
|
||||
// accidentally being interpolated into empty strings at prepare time.
|
||||
|
@ -53,26 +71,9 @@ type ProvisionHook struct {
|
|||
// data.
|
||||
func BasicPlaceholderData() map[string]string {
|
||||
placeholderData := map[string]string{}
|
||||
msg := "Build_%s. " + common.PlaceholderMsg
|
||||
placeholderData["ID"] = fmt.Sprintf(msg, "ID")
|
||||
// The following correspond to communicator-agnostic functions that are
|
||||
// part of the SSH and WinRM communicator implementations. These functions
|
||||
// are not part of the communicator interface, but are stored on the
|
||||
// Communicator Config and return the appropriate values rather than
|
||||
// depending on the actual communicator config values. E.g "Password"
|
||||
// reprosents either WinRMPassword or SSHPassword, which makes this more
|
||||
// useful if a template contains multiple builds.
|
||||
placeholderData["Host"] = fmt.Sprintf(msg, "Host")
|
||||
placeholderData["Port"] = fmt.Sprintf(msg, "Port")
|
||||
placeholderData["User"] = fmt.Sprintf(msg, "User")
|
||||
placeholderData["Password"] = fmt.Sprintf(msg, "Password")
|
||||
placeholderData["ConnType"] = fmt.Sprintf(msg, "Type")
|
||||
placeholderData["PackerRunUUID"] = fmt.Sprintf(msg, "PackerRunUUID")
|
||||
placeholderData["PackerHTTPPort"] = fmt.Sprintf(msg, "PackerHTTPPort")
|
||||
placeholderData["PackerHTTPIP"] = fmt.Sprintf(msg, "PackerHTTPIP")
|
||||
placeholderData["PackerHTTPAddr"] = fmt.Sprintf(msg, "PackerHTTPAddr")
|
||||
placeholderData["SSHPublicKey"] = fmt.Sprintf(msg, "SSHPublicKey")
|
||||
placeholderData["SSHPrivateKey"] = fmt.Sprintf(msg, "SSHPrivateKey")
|
||||
for _, key := range BuilderDataCommonKeys {
|
||||
placeholderData[key] = fmt.Sprintf("Build_%s. "+common.PlaceholderMsg, key)
|
||||
}
|
||||
|
||||
// Backwards-compatability: WinRM Password can get through without forcing
|
||||
// the generated func validation.
|
||||
|
|
Loading…
Reference in New Issue