From ff59cfdaaed8e017674328d0d2e746529edc6480 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 9 May 2019 16:36:32 -0700 Subject: [PATCH 1/2] Work around bug in libvirt-vagrant plugin by changing directories instead of supplying absolute path to output box --- builder/vagrant/driver_2_2.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/builder/vagrant/driver_2_2.go b/builder/vagrant/driver_2_2.go index dbabf7b21..badfea14b 100644 --- a/builder/vagrant/driver_2_2.go +++ b/builder/vagrant/driver_2_2.go @@ -6,7 +6,6 @@ import ( "log" "os" "os/exec" - "path/filepath" "regexp" "strings" @@ -71,7 +70,16 @@ func (d *Vagrant_2_2_Driver) Destroy(id string) error { // Calls "vagrant package" func (d *Vagrant_2_2_Driver) Package(args []string) error { - args = append(args, "--output", filepath.Join(d.VagrantCWD, "package.box")) + // Ideally we'd pass vagrantCWD into the package command but + // we have to change directorie into the vagrant cwd instead in order to + // work around an upstream bug with the vagrant-libvirt plugin. + // We can stop doing this when + // https://github.com/vagrant-libvirt/vagrant-libvirt/issues/765 + // is fixed. + oldDir, _ := os.Getwd() + os.Chdir(d.VagrantCWD) + defer os.Chdir(oldDir) + args = append(args, "--output", "package.box") _, _, err := d.vagrantCmd(append([]string{"package"}, args...)...) return err } From 783f6938cf3ed08d923297f6be4be96024ce678b Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 13 May 2019 10:43:09 +0200 Subject: [PATCH 2/2] Update builder/vagrant/driver_2_2.go --- builder/vagrant/driver_2_2.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/vagrant/driver_2_2.go b/builder/vagrant/driver_2_2.go index badfea14b..4b985bca1 100644 --- a/builder/vagrant/driver_2_2.go +++ b/builder/vagrant/driver_2_2.go @@ -71,7 +71,7 @@ func (d *Vagrant_2_2_Driver) Destroy(id string) error { // Calls "vagrant package" func (d *Vagrant_2_2_Driver) Package(args []string) error { // Ideally we'd pass vagrantCWD into the package command but - // we have to change directorie into the vagrant cwd instead in order to + // we have to change directory into the vagrant cwd instead in order to // work around an upstream bug with the vagrant-libvirt plugin. // We can stop doing this when // https://github.com/vagrant-libvirt/vagrant-libvirt/issues/765