Adding new "Options" configuration parameter for

the puppet-masterless provisioner, to allow for specifying additional
options to pass to the execute command
This commit is contained in:
Trevor Suarez 2015-11-03 12:30:55 -05:00
parent 70e7e953b1
commit ebed9e53fb
1 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,9 @@ type Config struct {
// The command used to execute Puppet.
ExecuteCommand string `mapstructure:"execute_command"`
// Additional options to pass when executing Puppet
Options []string
// Additional facts to set when executing Puppet
Facter map[string]string
@ -62,6 +65,7 @@ type ExecuteTemplate struct {
ManifestFile string
ManifestDir string
Sudo bool
Options string
}
func (p *Provisioner) Prepare(raws ...interface{}) error {
@ -86,6 +90,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
"{{if ne .HieraConfigPath \"\"}}--hiera_config='{{.HieraConfigPath}}' {{end}}" +
"{{if ne .ManifestDir \"\"}}--manifestdir='{{.ManifestDir}}' {{end}}" +
"--detailed-exitcodes " +
"{{.Options}} " +
"{{.ManifestFile}}"
}
@ -218,6 +223,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
ModulePath: strings.Join(modulePaths, ":"),
Sudo: !p.config.PreventSudo,
WorkingDir: p.config.WorkingDir,
Options: strings.Join(p.config.Options, " "),
}
command, err := interpolate.Render(p.config.ExecuteCommand, &p.config.ctx)
if err != nil {