Renaming the config parameter from "options"

to "extra_arguments"
This commit is contained in:
Trevor Suarez 2015-11-03 17:55:03 -05:00
parent 4ea7e3473d
commit 627a8fe819
3 changed files with 14 additions and 14 deletions

View File

@ -22,8 +22,8 @@ type Config struct {
// The command used to execute Puppet.
ExecuteCommand string `mapstructure:"execute_command"`
// Additional options to pass when executing Puppet
Options []string
// Additional arguments to pass when executing Puppet
ExtraArguments []string `mapstructure:"extra_arguments"`
// Additional facts to set when executing Puppet
Facter map[string]string
@ -65,7 +65,7 @@ type ExecuteTemplate struct {
ManifestFile string
ManifestDir string
Sudo bool
Options string
ExtraArguments string
}
func (p *Provisioner) Prepare(raws ...interface{}) error {
@ -90,7 +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}} " +
"{{.ExtraArguments}} " +
"{{.ManifestFile}}"
}
@ -223,7 +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, " "),
ExtraArguments: strings.Join(p.config.ExtraArguments, " "),
}
command, err := interpolate.Render(p.config.ExecuteCommand, &p.config.ctx)
if err != nil {

View File

@ -180,10 +180,10 @@ func TestProvisionerPrepare_facterFacts(t *testing.T) {
}
}
func TestProvisionerPrepare_options(t *testing.T) {
func TestProvisionerPrepare_extraArguments(t *testing.T) {
config := testConfig()
delete(config, "options")
delete(config, "extra_arguments")
p := new(Provisioner)
err := p.Prepare(config)
if err != nil {
@ -191,14 +191,14 @@ func TestProvisionerPrepare_options(t *testing.T) {
}
// Test with malformed fact
config["options"] = "{{}}"
config["extra_arguments"] = "{{}}"
p = new(Provisioner)
err = p.Prepare(config)
if err == nil {
t.Fatal("should be an error")
}
config["options"] = []string{
config["extra_arguments"] = []string{
"arg",
}
@ -209,18 +209,18 @@ func TestProvisionerPrepare_options(t *testing.T) {
}
}
func TestProvisionerProvision_options(t *testing.T) {
func TestProvisionerProvision_extraArguments(t *testing.T) {
config := testConfig()
ui := &packer.MachineReadableUi{
Writer: ioutil.Discard,
}
comm := new(packer.MockCommunicator)
options := []string{
extraArguments := []string{
"--some-arg=yup",
"--some-other-arg",
}
config["options"] = options
config["extra_arguments"] = extraArguments
p := new(Provisioner)
err := p.Prepare(config)
@ -233,7 +233,7 @@ func TestProvisionerProvision_options(t *testing.T) {
t.Fatalf("err: %s", err)
}
expectedArgs := strings.Join(options, " ")
expectedArgs := strings.Join(extraArguments, " ")
if !strings.Contains(comm.StartCmd.Command, expectedArgs) {
t.Fatalf("Command %q doesn't contain the expected arguments %q", comm.StartCmd.Command, expectedArgs)

View File

@ -59,7 +59,7 @@ Optional parameters:
variables](/docs/templates/configuration-templates.html) available. See
below for more information.
- `options` (array of strings) - This is an array of additional options to
- `extra_arguments` (array of strings) - This is an array of additional options to
pass to the puppet command when executing puppet. This allows for
customization of the `execute_command` without having to completely replace
or include it's contents, making forward-compatible customizations much