Merge pull request #5341 from c22/issue_5338
Fix facterVar separator bug reported in #5338
This commit is contained in:
commit
d26e28a028
@ -71,6 +71,7 @@ type guestOSTypeConfig struct {
|
|||||||
stagingDir string
|
stagingDir string
|
||||||
executeCommand string
|
executeCommand string
|
||||||
facterVarsFmt string
|
facterVarsFmt string
|
||||||
|
facterVarsJoiner string
|
||||||
modulePathJoiner string
|
modulePathJoiner string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +87,7 @@ var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
|||||||
"{{if ne .ExtraArguments \"\"}}{{.ExtraArguments}} {{end}}" +
|
"{{if ne .ExtraArguments \"\"}}{{.ExtraArguments}} {{end}}" +
|
||||||
"{{.ManifestFile}}",
|
"{{.ManifestFile}}",
|
||||||
facterVarsFmt: "FACTER_%s='%s'",
|
facterVarsFmt: "FACTER_%s='%s'",
|
||||||
|
facterVarsJoiner: " ",
|
||||||
modulePathJoiner: ":",
|
modulePathJoiner: ":",
|
||||||
},
|
},
|
||||||
provisioner.WindowsOSType: {
|
provisioner.WindowsOSType: {
|
||||||
@ -98,7 +100,8 @@ var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
|||||||
"--detailed-exitcodes " +
|
"--detailed-exitcodes " +
|
||||||
"{{if ne .ExtraArguments \"\"}}{{.ExtraArguments}} {{end}}" +
|
"{{if ne .ExtraArguments \"\"}}{{.ExtraArguments}} {{end}}" +
|
||||||
"{{.ManifestFile}}",
|
"{{.ManifestFile}}",
|
||||||
facterVarsFmt: "SET \"FACTER_%s=%s\" &",
|
facterVarsFmt: "SET \"FACTER_%s=%s\"",
|
||||||
|
facterVarsJoiner: " & ",
|
||||||
modulePathJoiner: ";",
|
modulePathJoiner: ";",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -282,7 +285,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
|||||||
|
|
||||||
// Execute Puppet
|
// Execute Puppet
|
||||||
p.config.ctx.Data = &ExecuteTemplate{
|
p.config.ctx.Data = &ExecuteTemplate{
|
||||||
FacterVars: strings.Join(facterVars, " "),
|
FacterVars: strings.Join(facterVars, p.guestOSTypeConfig.facterVarsJoiner),
|
||||||
HieraConfigPath: remoteHieraConfigPath,
|
HieraConfigPath: remoteHieraConfigPath,
|
||||||
ManifestDir: remoteManifestDir,
|
ManifestDir: remoteManifestDir,
|
||||||
ManifestFile: remoteManifestFile,
|
ManifestFile: remoteManifestFile,
|
||||||
|
@ -15,9 +15,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type guestOSTypeConfig struct {
|
type guestOSTypeConfig struct {
|
||||||
executeCommand string
|
executeCommand string
|
||||||
facterVarsFmt string
|
facterVarsFmt string
|
||||||
stagingDir string
|
facterVarsJoiner string
|
||||||
|
stagingDir string
|
||||||
}
|
}
|
||||||
|
|
||||||
var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
||||||
@ -31,8 +32,9 @@ var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
|||||||
"{{if ne .ClientCertPath \"\"}}--certdir='{{.ClientCertPath}}' {{end}}" +
|
"{{if ne .ClientCertPath \"\"}}--certdir='{{.ClientCertPath}}' {{end}}" +
|
||||||
"{{if ne .ClientPrivateKeyPath \"\"}}--privatekeydir='{{.ClientPrivateKeyPath}}' {{end}}" +
|
"{{if ne .ClientPrivateKeyPath \"\"}}--privatekeydir='{{.ClientPrivateKeyPath}}' {{end}}" +
|
||||||
"--detailed-exitcodes",
|
"--detailed-exitcodes",
|
||||||
facterVarsFmt: "FACTER_%s='%s'",
|
facterVarsFmt: "FACTER_%s='%s'",
|
||||||
stagingDir: "/tmp/packer-puppet-server",
|
facterVarsJoiner: " ",
|
||||||
|
stagingDir: "/tmp/packer-puppet-server",
|
||||||
},
|
},
|
||||||
provisioner.WindowsOSType: {
|
provisioner.WindowsOSType: {
|
||||||
executeCommand: "{{.FacterVars}} " +
|
executeCommand: "{{.FacterVars}} " +
|
||||||
@ -44,8 +46,9 @@ var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
|||||||
"{{if ne .ClientCertPath \"\"}}--certdir='{{.ClientCertPath}}' {{end}}" +
|
"{{if ne .ClientCertPath \"\"}}--certdir='{{.ClientCertPath}}' {{end}}" +
|
||||||
"{{if ne .ClientPrivateKeyPath \"\"}}--privatekeydir='{{.ClientPrivateKeyPath}}' {{end}}" +
|
"{{if ne .ClientPrivateKeyPath \"\"}}--privatekeydir='{{.ClientPrivateKeyPath}}' {{end}}" +
|
||||||
"--detailed-exitcodes",
|
"--detailed-exitcodes",
|
||||||
facterVarsFmt: "SET \"FACTER_%s=%s\" &",
|
facterVarsFmt: "SET \"FACTER_%s=%s\"",
|
||||||
stagingDir: "C:/Windows/Temp/packer-puppet-server",
|
facterVarsJoiner: " & ",
|
||||||
|
stagingDir: "C:/Windows/Temp/packer-puppet-server",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +225,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
|||||||
|
|
||||||
// Execute Puppet
|
// Execute Puppet
|
||||||
p.config.ctx.Data = &ExecuteTemplate{
|
p.config.ctx.Data = &ExecuteTemplate{
|
||||||
FacterVars: strings.Join(facterVars, " "),
|
FacterVars: strings.Join(facterVars, p.guestOSTypeConfig.facterVarsJoiner),
|
||||||
ClientCertPath: remoteClientCertPath,
|
ClientCertPath: remoteClientCertPath,
|
||||||
ClientPrivateKeyPath: remoteClientPrivateKeyPath,
|
ClientPrivateKeyPath: remoteClientPrivateKeyPath,
|
||||||
PuppetNode: p.config.PuppetNode,
|
PuppetNode: p.config.PuppetNode,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user