From 3d94462e37a2dace1600f64689142f0eaab90aeb Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 17 May 2015 17:35:39 +0300 Subject: [PATCH] remove image format from image name Signed-off-by: Vasiliy Tolstov --- builder/qemu/step_copy_disk.go | 7 +++---- builder/qemu/step_create_disk.go | 6 +++--- builder/qemu/step_resize_disk.go | 7 +++---- builder/qemu/step_run.go | 3 +-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/builder/qemu/step_copy_disk.go b/builder/qemu/step_copy_disk.go index 54c3084ac..dd5b6d8d7 100644 --- a/builder/qemu/step_copy_disk.go +++ b/builder/qemu/step_copy_disk.go @@ -3,7 +3,6 @@ package qemu import ( "fmt" "path/filepath" - "strings" "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" @@ -18,13 +17,13 @@ func (s *stepCopyDisk) Run(state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) isoPath := state.Get("iso_path").(string) ui := state.Get("ui").(packer.Ui) - path := filepath.Join(config.OutputDir, fmt.Sprintf("%s.%s", config.VMName, - strings.ToLower(config.Format))) - name := config.VMName + "." + strings.ToLower(config.Format) + path := filepath.Join(config.OutputDir, fmt.Sprintf("%s", config.VMName)) + name := config.VMName command := []string{ "convert", "-f", config.Format, + "-O", config.Format, isoPath, path, } diff --git a/builder/qemu/step_create_disk.go b/builder/qemu/step_create_disk.go index 986df1d2b..ed757ca8c 100644 --- a/builder/qemu/step_create_disk.go +++ b/builder/qemu/step_create_disk.go @@ -2,10 +2,10 @@ package qemu import ( "fmt" + "path/filepath" + "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" - "path/filepath" - "strings" ) // This step creates the virtual disk that will be used as the @@ -16,7 +16,7 @@ func (s *stepCreateDisk) Run(state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*config) driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) - name := config.VMName + "." + strings.ToLower(config.Format) + name := config.VMName path := filepath.Join(config.OutputDir, name) command := []string{ diff --git a/builder/qemu/step_resize_disk.go b/builder/qemu/step_resize_disk.go index 4e8536c32..6f27e6843 100644 --- a/builder/qemu/step_resize_disk.go +++ b/builder/qemu/step_resize_disk.go @@ -2,10 +2,10 @@ package qemu import ( "fmt" + "path/filepath" + "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" - "path/filepath" - "strings" ) // This step resizes the virtual disk that will be used as the @@ -16,8 +16,7 @@ func (s *stepResizeDisk) Run(state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*config) driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) - path := filepath.Join(config.OutputDir, fmt.Sprintf("%s.%s", config.VMName, - strings.ToLower(config.Format))) + path := filepath.Join(config.OutputDir, config.VMName) command := []string{ "resize", diff --git a/builder/qemu/step_run.go b/builder/qemu/step_run.go index 3f900d651..8524d9f9e 100644 --- a/builder/qemu/step_run.go +++ b/builder/qemu/step_run.go @@ -64,8 +64,7 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error vnc := fmt.Sprintf("0.0.0.0:%d", vncPort-5900) vmName := config.VMName - imgPath := filepath.Join(config.OutputDir, - fmt.Sprintf("%s.%s", vmName, strings.ToLower(config.Format))) + imgPath := filepath.Join(config.OutputDir, vmName) defaultArgs := make(map[string]string)