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:
parent
70e7e953b1
commit
ebed9e53fb
@ -22,6 +22,9 @@ type Config struct {
|
|||||||
// The command used to execute Puppet.
|
// The command used to execute Puppet.
|
||||||
ExecuteCommand string `mapstructure:"execute_command"`
|
ExecuteCommand string `mapstructure:"execute_command"`
|
||||||
|
|
||||||
|
// Additional options to pass when executing Puppet
|
||||||
|
Options []string
|
||||||
|
|
||||||
// Additional facts to set when executing Puppet
|
// Additional facts to set when executing Puppet
|
||||||
Facter map[string]string
|
Facter map[string]string
|
||||||
|
|
||||||
@ -62,6 +65,7 @@ type ExecuteTemplate struct {
|
|||||||
ManifestFile string
|
ManifestFile string
|
||||||
ManifestDir string
|
ManifestDir string
|
||||||
Sudo bool
|
Sudo bool
|
||||||
|
Options string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Provisioner) Prepare(raws ...interface{}) error {
|
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 .HieraConfigPath \"\"}}--hiera_config='{{.HieraConfigPath}}' {{end}}" +
|
||||||
"{{if ne .ManifestDir \"\"}}--manifestdir='{{.ManifestDir}}' {{end}}" +
|
"{{if ne .ManifestDir \"\"}}--manifestdir='{{.ManifestDir}}' {{end}}" +
|
||||||
"--detailed-exitcodes " +
|
"--detailed-exitcodes " +
|
||||||
|
"{{.Options}} " +
|
||||||
"{{.ManifestFile}}"
|
"{{.ManifestFile}}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,6 +223,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
|||||||
ModulePath: strings.Join(modulePaths, ":"),
|
ModulePath: strings.Join(modulePaths, ":"),
|
||||||
Sudo: !p.config.PreventSudo,
|
Sudo: !p.config.PreventSudo,
|
||||||
WorkingDir: p.config.WorkingDir,
|
WorkingDir: p.config.WorkingDir,
|
||||||
|
Options: strings.Join(p.config.Options, " "),
|
||||||
}
|
}
|
||||||
command, err := interpolate.Render(p.config.ExecuteCommand, &p.config.ctx)
|
command, err := interpolate.Render(p.config.ExecuteCommand, &p.config.ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user