provisioner/puppet-masterless: use Go 1.2 template comparators

This commit is contained in:
Mitchell Hashimoto 2013-12-11 12:37:54 -08:00
parent ae00414bbf
commit 895d87d9eb
2 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,12 @@
## 0.5.0 (unreleased)
BACKWARDS INCOMPATIBILITIES:
* provisioner/puppet-masterless: The `execute_command` no longer has
the `Has*` variables, since the templating language now supports
comparison operations. See the Go documentation for more info:
http://golang.org/pkg/text/template/
IMPROVEMENTS:
* core: Plugins communicate over a single TCP connection per plugin now,

View File

@ -49,11 +49,9 @@ type Provisioner struct {
type ExecuteTemplate struct {
FacterVars string
HasHieraConfigPath bool
HieraConfigPath string
ModulePath string
ManifestFile string
HasManifestDir bool
ManifestDir string
Sudo bool
}
@ -77,8 +75,8 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
if p.config.ExecuteCommand == "" {
p.config.ExecuteCommand = "{{.FacterVars}} {{if .Sudo}} sudo -E {{end}}" +
"puppet apply --verbose --modulepath='{{.ModulePath}}' " +
"{{if .HasHieraConfigPath}}--hiera_config='{{.HieraConfigPath}}' {{end}}" +
"{{if .HasManifestDir}}--manifestdir='{{.ManifestDir}}' {{end}}" +
"{{if .HieraConfigPath ne ""}}--hiera_config='{{.HieraConfigPath}}' {{end}}" +
"{{if .ManifestDir ne ""}}--manifestdir='{{.ManifestDir}}' {{end}}" +
"--detailed-exitcodes " +
"{{.ManifestFile}}"
}
@ -262,9 +260,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
// Execute Puppet
command, err := p.config.tpl.Process(p.config.ExecuteCommand, &ExecuteTemplate{
FacterVars: strings.Join(facterVars, " "),
HasHieraConfigPath: remoteHieraConfigPath != "",
HieraConfigPath: remoteHieraConfigPath,
HasManifestDir: remoteManifestDir != "",
ManifestDir: remoteManifestDir,
ManifestFile: remoteManifestFile,
ModulePath: strings.Join(modulePaths, ":"),