diff --git a/.web-docs/components/builder/vagrant/README.md b/.web-docs/components/builder/vagrant/README.md index d1dc9c5a..0df74684 100644 --- a/.web-docs/components/builder/vagrant/README.md +++ b/.web-docs/components/builder/vagrant/README.md @@ -90,8 +90,6 @@ the Compress post-processor will not work with this builder. This parameter is required when source_path have more than one provider, or when using vagrant-cloud post-processor. Defaults to unset. -- `vagrantfile_template` (string) - What vagrantfile to use - - `teardown_method` (string) - Whether to halt, suspend, or destroy the box when the build has completed. Defaults to "halt" diff --git a/builder/vagrant/builder.go b/builder/vagrant/builder.go index 8bc2849d..662b4251 100644 --- a/builder/vagrant/builder.go +++ b/builder/vagrant/builder.go @@ -94,8 +94,6 @@ type Config struct { Provider string `mapstructure:"provider" required:"false"` // Options for the "vagrant init" command - // What vagrantfile to use - VagrantfileTpl string `mapstructure:"vagrantfile_template"` // Whether to halt, suspend, or destroy the box when the build has // completed. Defaults to "halt" TeardownMethod string `mapstructure:"teardown_method" required:"false"` diff --git a/builder/vagrant/builder.hcl2spec.go b/builder/vagrant/builder.hcl2spec.go index 5f255bbf..8bbf2667 100644 --- a/builder/vagrant/builder.hcl2spec.go +++ b/builder/vagrant/builder.hcl2spec.go @@ -92,7 +92,6 @@ type FlatConfig struct { BoxName *string `mapstructure:"box_name" required:"false" cty:"box_name" hcl:"box_name"` InsertKey *bool `mapstructure:"insert_key" required:"false" cty:"insert_key" hcl:"insert_key"` Provider *string `mapstructure:"provider" required:"false" cty:"provider" hcl:"provider"` - VagrantfileTpl *string `mapstructure:"vagrantfile_template" cty:"vagrantfile_template" hcl:"vagrantfile_template"` TeardownMethod *string `mapstructure:"teardown_method" required:"false" cty:"teardown_method" hcl:"teardown_method"` BoxVersion *string `mapstructure:"box_version" required:"false" cty:"box_version" hcl:"box_version"` Template *string `mapstructure:"template" required:"false" cty:"template" hcl:"template"` @@ -203,7 +202,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "box_name": &hcldec.AttrSpec{Name: "box_name", Type: cty.String, Required: false}, "insert_key": &hcldec.AttrSpec{Name: "insert_key", Type: cty.Bool, Required: false}, "provider": &hcldec.AttrSpec{Name: "provider", Type: cty.String, Required: false}, - "vagrantfile_template": &hcldec.AttrSpec{Name: "vagrantfile_template", Type: cty.String, Required: false}, "teardown_method": &hcldec.AttrSpec{Name: "teardown_method", Type: cty.String, Required: false}, "box_version": &hcldec.AttrSpec{Name: "box_version", Type: cty.String, Required: false}, "template": &hcldec.AttrSpec{Name: "template", Type: cty.String, Required: false}, diff --git a/builder/vagrant/driver_2_2.go b/builder/vagrant/driver_2_2.go index a7be8de0..6ad49918 100644 --- a/builder/vagrant/driver_2_2.go +++ b/builder/vagrant/driver_2_2.go @@ -270,7 +270,7 @@ func (d *Vagrant_2_2_Driver) vagrantCmd(args ...string) (string, string, error) log.Printf("[vagrant driver] stdout: %s", line) stdoutString += line + "\n" } - _ = cmd.Wait() + err = cmd.Wait() if _, ok := err.(*exec.ExitError); ok { err = fmt.Errorf("Vagrant error: %s", stderrString) diff --git a/builder/vagrant/step_add_box.go b/builder/vagrant/step_add_box.go index 4ee042aa..ec56bc08 100644 --- a/builder/vagrant/step_add_box.go +++ b/builder/vagrant/step_add_box.go @@ -5,6 +5,7 @@ package vagrant import ( "context" + "fmt" "log" "strings" @@ -93,6 +94,7 @@ func (s *StepAddBox) Run(ctx context.Context, state multistep.StateBag) multiste // Call vagrant using prepared arguments err := driver.Add(addArgs) if err != nil { + err = fmt.Errorf("Failed to get box, if it is already in Vagrant, try using the `skip_add` option.\n%s", err) state.Put("error", err) return multistep.ActionHalt } diff --git a/docs-partials/builder/vagrant/Config-not-required.mdx b/docs-partials/builder/vagrant/Config-not-required.mdx index b6d2e709..6a643000 100644 --- a/docs-partials/builder/vagrant/Config-not-required.mdx +++ b/docs-partials/builder/vagrant/Config-not-required.mdx @@ -37,8 +37,6 @@ This parameter is required when source_path have more than one provider, or when using vagrant-cloud post-processor. Defaults to unset. -- `vagrantfile_template` (string) - What vagrantfile to use - - `teardown_method` (string) - Whether to halt, suspend, or destroy the box when the build has completed. Defaults to "halt"