remove image format from image name

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
Vasiliy Tolstov 2015-05-17 17:35:39 +03:00
parent 350a5f8cad
commit 3d94462e37
4 changed files with 10 additions and 13 deletions

View File

@ -3,7 +3,6 @@ package qemu
import ( import (
"fmt" "fmt"
"path/filepath" "path/filepath"
"strings"
"github.com/mitchellh/multistep" "github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
@ -18,13 +17,13 @@ func (s *stepCopyDisk) Run(state multistep.StateBag) multistep.StepAction {
driver := state.Get("driver").(Driver) driver := state.Get("driver").(Driver)
isoPath := state.Get("iso_path").(string) isoPath := state.Get("iso_path").(string)
ui := state.Get("ui").(packer.Ui) ui := state.Get("ui").(packer.Ui)
path := filepath.Join(config.OutputDir, fmt.Sprintf("%s.%s", config.VMName, path := filepath.Join(config.OutputDir, fmt.Sprintf("%s", config.VMName))
strings.ToLower(config.Format))) name := config.VMName
name := config.VMName + "." + strings.ToLower(config.Format)
command := []string{ command := []string{
"convert", "convert",
"-f", config.Format, "-f", config.Format,
"-O", config.Format,
isoPath, isoPath,
path, path,
} }

View File

@ -2,10 +2,10 @@ package qemu
import ( import (
"fmt" "fmt"
"path/filepath"
"github.com/mitchellh/multistep" "github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"path/filepath"
"strings"
) )
// This step creates the virtual disk that will be used as the // 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) config := state.Get("config").(*config)
driver := state.Get("driver").(Driver) driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packer.Ui) ui := state.Get("ui").(packer.Ui)
name := config.VMName + "." + strings.ToLower(config.Format) name := config.VMName
path := filepath.Join(config.OutputDir, name) path := filepath.Join(config.OutputDir, name)
command := []string{ command := []string{

View File

@ -2,10 +2,10 @@ package qemu
import ( import (
"fmt" "fmt"
"path/filepath"
"github.com/mitchellh/multistep" "github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"path/filepath"
"strings"
) )
// This step resizes the virtual disk that will be used as the // 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) config := state.Get("config").(*config)
driver := state.Get("driver").(Driver) driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packer.Ui) ui := state.Get("ui").(packer.Ui)
path := filepath.Join(config.OutputDir, fmt.Sprintf("%s.%s", config.VMName, path := filepath.Join(config.OutputDir, config.VMName)
strings.ToLower(config.Format)))
command := []string{ command := []string{
"resize", "resize",

View File

@ -64,8 +64,7 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
vnc := fmt.Sprintf("0.0.0.0:%d", vncPort-5900) vnc := fmt.Sprintf("0.0.0.0:%d", vncPort-5900)
vmName := config.VMName vmName := config.VMName
imgPath := filepath.Join(config.OutputDir, imgPath := filepath.Join(config.OutputDir, vmName)
fmt.Sprintf("%s.%s", vmName, strings.ToLower(config.Format)))
defaultArgs := make(map[string]string) defaultArgs := make(map[string]string)