Commit 895d87d9 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

provisioner/puppet-masterless: use Go 1.2 template comparators

parent ae00414b
## 0.5.0 (unreleased) ## 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: IMPROVEMENTS:
* core: Plugins communicate over a single TCP connection per plugin now, * core: Plugins communicate over a single TCP connection per plugin now,
......
...@@ -49,11 +49,9 @@ type Provisioner struct { ...@@ -49,11 +49,9 @@ type Provisioner struct {
type ExecuteTemplate struct { type ExecuteTemplate struct {
FacterVars string FacterVars string
HasHieraConfigPath bool
HieraConfigPath string HieraConfigPath string
ModulePath string ModulePath string
ManifestFile string ManifestFile string
HasManifestDir bool
ManifestDir string ManifestDir string
Sudo bool Sudo bool
} }
...@@ -77,8 +75,8 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { ...@@ -77,8 +75,8 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
if p.config.ExecuteCommand == "" { if p.config.ExecuteCommand == "" {
p.config.ExecuteCommand = "{{.FacterVars}} {{if .Sudo}} sudo -E {{end}}" + p.config.ExecuteCommand = "{{.FacterVars}} {{if .Sudo}} sudo -E {{end}}" +
"puppet apply --verbose --modulepath='{{.ModulePath}}' " + "puppet apply --verbose --modulepath='{{.ModulePath}}' " +
"{{if .HasHieraConfigPath}}--hiera_config='{{.HieraConfigPath}}' {{end}}" + "{{if .HieraConfigPath ne ""}}--hiera_config='{{.HieraConfigPath}}' {{end}}" +
"{{if .HasManifestDir}}--manifestdir='{{.ManifestDir}}' {{end}}" + "{{if .ManifestDir ne ""}}--manifestdir='{{.ManifestDir}}' {{end}}" +
"--detailed-exitcodes " + "--detailed-exitcodes " +
"{{.ManifestFile}}" "{{.ManifestFile}}"
} }
...@@ -262,9 +260,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { ...@@ -262,9 +260,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
// Execute Puppet // Execute Puppet
command, err := p.config.tpl.Process(p.config.ExecuteCommand, &ExecuteTemplate{ command, err := p.config.tpl.Process(p.config.ExecuteCommand, &ExecuteTemplate{
FacterVars: strings.Join(facterVars, " "), FacterVars: strings.Join(facterVars, " "),
HasHieraConfigPath: remoteHieraConfigPath != "",
HieraConfigPath: remoteHieraConfigPath, HieraConfigPath: remoteHieraConfigPath,
HasManifestDir: remoteManifestDir != "",
ManifestDir: remoteManifestDir, ManifestDir: remoteManifestDir,
ManifestFile: remoteManifestFile, ManifestFile: remoteManifestFile,
ModulePath: strings.Join(modulePaths, ":"), ModulePath: strings.Join(modulePaths, ":"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment