Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
d15bc904
Commit
d15bc904
authored
May 27, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox/iso: new interpolation
parent
b2b74431
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
100 additions
and
256 deletions
+100
-256
builder/virtualbox/common/export_config.go
builder/virtualbox/common/export_config.go
+4
-16
builder/virtualbox/common/export_opts.go
builder/virtualbox/common/export_opts.go
+3
-13
builder/virtualbox/common/floppy_config.go
builder/virtualbox/common/floppy_config.go
+3
-15
builder/virtualbox/common/output_config.go
builder/virtualbox/common/output_config.go
+5
-16
builder/virtualbox/common/run_config.go
builder/virtualbox/common/run_config.go
+3
-16
builder/virtualbox/common/shutdown_config.go
builder/virtualbox/common/shutdown_config.go
+4
-16
builder/virtualbox/common/ssh_config.go
builder/virtualbox/common/ssh_config.go
+3
-18
builder/virtualbox/common/step_download_guest_additions.go
builder/virtualbox/common/step_download_guest_additions.go
+8
-6
builder/virtualbox/common/step_type_boot_command.go
builder/virtualbox/common/step_type_boot_command.go
+7
-5
builder/virtualbox/common/step_upload_guest_additions.go
builder/virtualbox/common/step_upload_guest_additions.go
+7
-5
builder/virtualbox/common/step_vboxmanage.go
builder/virtualbox/common/step_vboxmanage.go
+6
-4
builder/virtualbox/common/vbox_version_config.go
builder/virtualbox/common/vbox_version_config.go
+3
-17
builder/virtualbox/common/vboxmanage_config.go
builder/virtualbox/common/vboxmanage_config.go
+3
-14
builder/virtualbox/common/vboxmanage_post_config.go
builder/virtualbox/common/vboxmanage_post_config.go
+3
-14
builder/virtualbox/iso/builder.go
builder/virtualbox/iso/builder.go
+33
-76
builder/virtualbox/iso/step_attach_iso.go
builder/virtualbox/iso/step_attach_iso.go
+2
-2
builder/virtualbox/iso/step_create_disk.go
builder/virtualbox/iso/step_create_disk.go
+1
-1
builder/virtualbox/iso/step_create_vm.go
builder/virtualbox/iso/step_create_vm.go
+1
-1
builder/virtualbox/iso/step_http_server.go
builder/virtualbox/iso/step_http_server.go
+1
-1
No files found.
builder/virtualbox/common/export_config.go
View file @
d15bc904
...
@@ -2,32 +2,20 @@ package common
...
@@ -2,32 +2,20 @@ package common
import
(
import
(
"errors"
"errors"
"fmt"
"github.com/mitchellh/packer/
packer
"
"github.com/mitchellh/packer/
template/interpolate
"
)
)
type
ExportConfig
struct
{
type
ExportConfig
struct
{
Format
string
`mapstruture:"format"`
Format
string
`mapstruture:"format"`
}
}
func
(
c
*
ExportConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
func
(
c
*
ExportConfig
)
Prepare
(
ctx
*
interpolate
.
Context
)
[]
error
{
if
c
.
Format
==
""
{
if
c
.
Format
==
""
{
c
.
Format
=
"ovf"
c
.
Format
=
"ovf"
}
}
templates
:=
map
[
string
]
*
string
{
var
errs
[]
error
"format"
:
&
c
.
Format
,
}
errs
:=
make
([]
error
,
0
)
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
t
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
if
c
.
Format
!=
"ovf"
&&
c
.
Format
!=
"ova"
{
if
c
.
Format
!=
"ovf"
&&
c
.
Format
!=
"ova"
{
errs
=
append
(
errs
,
errs
=
append
(
errs
,
errors
.
New
(
"invalid format, only 'ovf' or 'ova' are allowed"
))
errors
.
New
(
"invalid format, only 'ovf' or 'ova' are allowed"
))
...
...
builder/virtualbox/common/export_opts.go
View file @
d15bc904
package
common
package
common
import
(
import
(
"fmt"
"github.com/mitchellh/packer/template/interpolate"
"github.com/mitchellh/packer/packer"
)
)
type
ExportOpts
struct
{
type
ExportOpts
struct
{
ExportOpts
[]
string
`mapstructure:"export_opts"`
ExportOpts
[]
string
`mapstructure:"export_opts"`
}
}
func
(
c
*
ExportOpts
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
func
(
c
*
ExportOpts
)
Prepare
(
ctx
*
interpolate
.
Context
)
[]
error
{
if
c
.
ExportOpts
==
nil
{
if
c
.
ExportOpts
==
nil
{
c
.
ExportOpts
=
make
([]
string
,
0
)
c
.
ExportOpts
=
make
([]
string
,
0
)
}
}
errs
:=
make
([]
error
,
0
)
return
nil
for
i
,
str
:=
range
c
.
ExportOpts
{
var
err
error
c
.
ExportOpts
[
i
],
err
=
t
.
Process
(
str
,
nil
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
"export_opts"
,
err
))
}
}
return
errs
}
}
builder/virtualbox/common/floppy_config.go
View file @
d15bc904
package
common
package
common
import
(
import
(
"fmt"
"github.com/mitchellh/packer/template/interpolate"
"github.com/mitchellh/packer/packer"
)
)
// FloppyConfig is configuration related to created floppy disks and attaching
// FloppyConfig is configuration related to created floppy disks and attaching
...
@@ -12,20 +10,10 @@ type FloppyConfig struct {
...
@@ -12,20 +10,10 @@ type FloppyConfig struct {
FloppyFiles
[]
string
`mapstructure:"floppy_files"`
FloppyFiles
[]
string
`mapstructure:"floppy_files"`
}
}
func
(
c
*
FloppyConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
func
(
c
*
FloppyConfig
)
Prepare
(
ctx
*
interpolate
.
Context
)
[]
error
{
if
c
.
FloppyFiles
==
nil
{
if
c
.
FloppyFiles
==
nil
{
c
.
FloppyFiles
=
make
([]
string
,
0
)
c
.
FloppyFiles
=
make
([]
string
,
0
)
}
}
errs
:=
make
([]
error
,
0
)
return
nil
for
i
,
file
:=
range
c
.
FloppyFiles
{
var
err
error
c
.
FloppyFiles
[
i
],
err
=
t
.
Process
(
file
,
nil
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing floppy_files[%d]: %s"
,
i
,
err
))
}
}
return
errs
}
}
builder/virtualbox/common/output_config.go
View file @
d15bc904
...
@@ -2,33 +2,22 @@ package common
...
@@ -2,33 +2,22 @@ package common
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/packer"
"os"
"os"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/template/interpolate"
)
)
type
OutputConfig
struct
{
type
OutputConfig
struct
{
OutputDir
string
`mapstructure:"output_directory"`
OutputDir
string
`mapstructure:"output_directory"`
}
}
func
(
c
*
OutputConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
,
pc
*
common
.
PackerConfig
)
[]
error
{
func
(
c
*
OutputConfig
)
Prepare
(
ctx
*
interpolate
.
Context
,
pc
*
common
.
PackerConfig
)
[]
error
{
if
c
.
OutputDir
==
""
{
if
c
.
OutputDir
==
""
{
c
.
OutputDir
=
fmt
.
Sprintf
(
"output-%s"
,
pc
.
PackerBuildName
)
c
.
OutputDir
=
fmt
.
Sprintf
(
"output-%s"
,
pc
.
PackerBuildName
)
}
}
templates
:=
map
[
string
]
*
string
{
var
errs
[]
error
"output_directory"
:
&
c
.
OutputDir
,
}
errs
:=
make
([]
error
,
0
)
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
t
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
if
!
pc
.
PackerForce
{
if
!
pc
.
PackerForce
{
if
_
,
err
:=
os
.
Stat
(
c
.
OutputDir
);
err
==
nil
{
if
_
,
err
:=
os
.
Stat
(
c
.
OutputDir
);
err
==
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
errs
=
append
(
errs
,
fmt
.
Errorf
(
...
...
builder/virtualbox/common/run_config.go
View file @
d15bc904
...
@@ -5,7 +5,7 @@ import (
...
@@ -5,7 +5,7 @@ import (
"fmt"
"fmt"
"time"
"time"
"github.com/mitchellh/packer/
packer
"
"github.com/mitchellh/packer/
template/interpolate
"
)
)
type
RunConfig
struct
{
type
RunConfig
struct
{
...
@@ -19,7 +19,7 @@ type RunConfig struct {
...
@@ -19,7 +19,7 @@ type RunConfig struct {
BootWait
time
.
Duration
``
BootWait
time
.
Duration
``
}
}
func
(
c
*
RunConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
func
(
c
*
RunConfig
)
Prepare
(
ctx
*
interpolate
.
Context
)
[]
error
{
if
c
.
RawBootWait
==
""
{
if
c
.
RawBootWait
==
""
{
c
.
RawBootWait
=
"10s"
c
.
RawBootWait
=
"10s"
}
}
...
@@ -32,20 +32,7 @@ func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
...
@@ -32,20 +32,7 @@ func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
c
.
HTTPPortMax
=
9000
c
.
HTTPPortMax
=
9000
}
}
templates
:=
map
[
string
]
*
string
{
var
errs
[]
error
"boot_wait"
:
&
c
.
RawBootWait
,
"http_directory"
:
&
c
.
HTTPDir
,
}
errs
:=
make
([]
error
,
0
)
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
t
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
var
err
error
var
err
error
c
.
BootWait
,
err
=
time
.
ParseDuration
(
c
.
RawBootWait
)
c
.
BootWait
,
err
=
time
.
ParseDuration
(
c
.
RawBootWait
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
builder/virtualbox/common/shutdown_config.go
View file @
d15bc904
...
@@ -2,8 +2,9 @@ package common
...
@@ -2,8 +2,9 @@ package common
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/packer/packer"
"time"
"time"
"github.com/mitchellh/packer/template/interpolate"
)
)
type
ShutdownConfig
struct
{
type
ShutdownConfig
struct
{
...
@@ -13,25 +14,12 @@ type ShutdownConfig struct {
...
@@ -13,25 +14,12 @@ type ShutdownConfig struct {
ShutdownTimeout
time
.
Duration
``
ShutdownTimeout
time
.
Duration
``
}
}
func
(
c
*
ShutdownConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
func
(
c
*
ShutdownConfig
)
Prepare
(
ctx
*
interpolate
.
Context
)
[]
error
{
if
c
.
RawShutdownTimeout
==
""
{
if
c
.
RawShutdownTimeout
==
""
{
c
.
RawShutdownTimeout
=
"5m"
c
.
RawShutdownTimeout
=
"5m"
}
}
templates
:=
map
[
string
]
*
string
{
var
errs
[]
error
"shutdown_command"
:
&
c
.
ShutdownCommand
,
"shutdown_timeout"
:
&
c
.
RawShutdownTimeout
,
}
errs
:=
make
([]
error
,
0
)
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
t
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
var
err
error
var
err
error
c
.
ShutdownTimeout
,
err
=
time
.
ParseDuration
(
c
.
RawShutdownTimeout
)
c
.
ShutdownTimeout
,
err
=
time
.
ParseDuration
(
c
.
RawShutdownTimeout
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
builder/virtualbox/common/ssh_config.go
View file @
d15bc904
...
@@ -7,7 +7,7 @@ import (
...
@@ -7,7 +7,7 @@ import (
"time"
"time"
commonssh
"github.com/mitchellh/packer/common/ssh"
commonssh
"github.com/mitchellh/packer/common/ssh"
"github.com/mitchellh/packer/
packer
"
"github.com/mitchellh/packer/
template/interpolate
"
)
)
type
SSHConfig
struct
{
type
SSHConfig
struct
{
...
@@ -22,7 +22,7 @@ type SSHConfig struct {
...
@@ -22,7 +22,7 @@ type SSHConfig struct {
SSHWaitTimeout
time
.
Duration
SSHWaitTimeout
time
.
Duration
}
}
func
(
c
*
SSHConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
func
(
c
*
SSHConfig
)
Prepare
(
ctx
*
interpolate
.
Context
)
[]
error
{
if
c
.
SSHHostPortMin
==
0
{
if
c
.
SSHHostPortMin
==
0
{
c
.
SSHHostPortMin
=
2222
c
.
SSHHostPortMin
=
2222
}
}
...
@@ -39,22 +39,7 @@ func (c *SSHConfig) Prepare(t *packer.ConfigTemplate) []error {
...
@@ -39,22 +39,7 @@ func (c *SSHConfig) Prepare(t *packer.ConfigTemplate) []error {
c
.
RawSSHWaitTimeout
=
"20m"
c
.
RawSSHWaitTimeout
=
"20m"
}
}
templates
:=
map
[
string
]
*
string
{
var
errs
[]
error
"ssh_key_path"
:
&
c
.
SSHKeyPath
,
"ssh_password"
:
&
c
.
SSHPassword
,
"ssh_username"
:
&
c
.
SSHUser
,
"ssh_wait_timeout"
:
&
c
.
RawSSHWaitTimeout
,
}
errs
:=
make
([]
error
,
0
)
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
t
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
if
c
.
SSHKeyPath
!=
""
{
if
c
.
SSHKeyPath
!=
""
{
if
_
,
err
:=
os
.
Stat
(
c
.
SSHKeyPath
);
err
!=
nil
{
if
_
,
err
:=
os
.
Stat
(
c
.
SSHKeyPath
);
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"ssh_key_path is invalid: %s"
,
err
))
errs
=
append
(
errs
,
fmt
.
Errorf
(
"ssh_key_path is invalid: %s"
,
err
))
...
...
builder/virtualbox/common/step_download_guest_additions.go
View file @
d15bc904
...
@@ -3,14 +3,16 @@ package common
...
@@ -3,14 +3,16 @@ package common
import
(
import
(
"bytes"
"bytes"
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/packer"
"io"
"io"
"io/ioutil"
"io/ioutil"
"log"
"log"
"os"
"os"
"strings"
"strings"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/template/interpolate"
)
)
var
additionsVersionMap
=
map
[
string
]
string
{
var
additionsVersionMap
=
map
[
string
]
string
{
...
@@ -31,7 +33,7 @@ type StepDownloadGuestAdditions struct {
...
@@ -31,7 +33,7 @@ type StepDownloadGuestAdditions struct {
GuestAdditionsMode
string
GuestAdditionsMode
string
GuestAdditionsURL
string
GuestAdditionsURL
string
GuestAdditionsSHA256
string
GuestAdditionsSHA256
string
Tpl
*
packer
.
ConfigTemplate
Ctx
interpolate
.
Context
}
}
func
(
s
*
StepDownloadGuestAdditions
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
StepDownloadGuestAdditions
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
...
@@ -67,11 +69,11 @@ func (s *StepDownloadGuestAdditions) Run(state multistep.StateBag) multistep.Ste
...
@@ -67,11 +69,11 @@ func (s *StepDownloadGuestAdditions) Run(state multistep.StateBag) multistep.Ste
// Use the provided source (URL or file path) or generate it
// Use the provided source (URL or file path) or generate it
url
:=
s
.
GuestAdditionsURL
url
:=
s
.
GuestAdditionsURL
if
url
!=
""
{
if
url
!=
""
{
tplData
:
=
&
guestAdditionsUrlTemplate
{
s
.
Ctx
.
Data
=
&
guestAdditionsUrlTemplate
{
Version
:
version
,
Version
:
version
,
}
}
url
,
err
=
s
.
Tpl
.
Process
(
url
,
tplData
)
url
,
err
=
interpolate
.
Render
(
url
,
&
s
.
Ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error preparing guest additions url: %s"
,
err
)
err
:=
fmt
.
Errorf
(
"Error preparing guest additions url: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
state
.
Put
(
"error"
,
err
)
...
...
builder/virtualbox/common/step_type_boot_command.go
View file @
d15bc904
...
@@ -2,13 +2,15 @@ package common
...
@@ -2,13 +2,15 @@ package common
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"log"
"log"
"strings"
"strings"
"time"
"time"
"unicode"
"unicode"
"unicode/utf8"
"unicode/utf8"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/template/interpolate"
)
)
const
KeyLeftShift
uint32
=
0xFFE1
const
KeyLeftShift
uint32
=
0xFFE1
...
@@ -32,7 +34,7 @@ type bootCommandTemplateData struct {
...
@@ -32,7 +34,7 @@ type bootCommandTemplateData struct {
type
StepTypeBootCommand
struct
{
type
StepTypeBootCommand
struct
{
BootCommand
[]
string
BootCommand
[]
string
VMName
string
VMName
string
Tpl
*
packer
.
ConfigTemplate
Ctx
interpolate
.
Context
}
}
func
(
s
*
StepTypeBootCommand
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
StepTypeBootCommand
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
...
@@ -41,7 +43,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
...
@@ -41,7 +43,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
vmName
:=
state
.
Get
(
"vmName"
)
.
(
string
)
vmName
:=
state
.
Get
(
"vmName"
)
.
(
string
)
tplData
:
=
&
bootCommandTemplateData
{
s
.
Ctx
.
Data
=
&
bootCommandTemplateData
{
"10.0.2.2"
,
"10.0.2.2"
,
httpPort
,
httpPort
,
s
.
VMName
,
s
.
VMName
,
...
@@ -49,7 +51,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
...
@@ -49,7 +51,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
ui
.
Say
(
"Typing the boot command..."
)
ui
.
Say
(
"Typing the boot command..."
)
for
_
,
command
:=
range
s
.
BootCommand
{
for
_
,
command
:=
range
s
.
BootCommand
{
command
,
err
:=
s
.
Tpl
.
Process
(
command
,
tplData
)
command
,
err
:=
interpolate
.
Render
(
command
,
&
s
.
Ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error preparing boot command: %s"
,
err
)
err
:=
fmt
.
Errorf
(
"Error preparing boot command: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
state
.
Put
(
"error"
,
err
)
...
...
builder/virtualbox/common/step_upload_guest_additions.go
View file @
d15bc904
...
@@ -2,10 +2,12 @@ package common
...
@@ -2,10 +2,12 @@ package common
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"log"
"log"
"os"
"os"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/template/interpolate"
)
)
type
guestAdditionsPathTemplate
struct
{
type
guestAdditionsPathTemplate
struct
{
...
@@ -16,7 +18,7 @@ type guestAdditionsPathTemplate struct {
...
@@ -16,7 +18,7 @@ type guestAdditionsPathTemplate struct {
type
StepUploadGuestAdditions
struct
{
type
StepUploadGuestAdditions
struct
{
GuestAdditionsMode
string
GuestAdditionsMode
string
GuestAdditionsPath
string
GuestAdditionsPath
string
Tpl
*
packer
.
ConfigTemplate
Ctx
interpolate
.
Context
}
}
func
(
s
*
StepUploadGuestAdditions
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
StepUploadGuestAdditions
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
...
@@ -45,11 +47,11 @@ func (s *StepUploadGuestAdditions) Run(state multistep.StateBag) multistep.StepA
...
@@ -45,11 +47,11 @@ func (s *StepUploadGuestAdditions) Run(state multistep.StateBag) multistep.StepA
return
multistep
.
ActionHalt
return
multistep
.
ActionHalt
}
}
tplData
:
=
&
guestAdditionsPathTemplate
{
s
.
Ctx
.
Data
=
&
guestAdditionsPathTemplate
{
Version
:
version
,
Version
:
version
,
}
}
s
.
GuestAdditionsPath
,
err
=
s
.
Tpl
.
Process
(
s
.
GuestAdditionsPath
,
tplData
)
s
.
GuestAdditionsPath
,
err
=
interpolate
.
Render
(
s
.
GuestAdditionsPath
,
&
s
.
Ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error preparing guest additions path: %s"
,
err
)
err
:=
fmt
.
Errorf
(
"Error preparing guest additions path: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
state
.
Put
(
"error"
,
err
)
...
...
builder/virtualbox/common/step_vboxmanage.go
View file @
d15bc904
...
@@ -2,9 +2,11 @@ package common
...
@@ -2,9 +2,11 @@ package common
import
(
import
(
"fmt"
"fmt"
"strings"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"
strings
"
"
github.com/mitchellh/packer/template/interpolate
"
)
)
type
commandTemplate
struct
{
type
commandTemplate
struct
{
...
@@ -22,7 +24,7 @@ type commandTemplate struct {
...
@@ -22,7 +24,7 @@ type commandTemplate struct {
// Produces:
// Produces:
type
StepVBoxManage
struct
{
type
StepVBoxManage
struct
{
Commands
[][]
string
Commands
[][]
string
Tpl
*
packer
.
ConfigTemplate
Ctx
interpolate
.
Context
}
}
func
(
s
*
StepVBoxManage
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
StepVBoxManage
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
...
@@ -34,7 +36,7 @@ func (s *StepVBoxManage) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -34,7 +36,7 @@ func (s *StepVBoxManage) Run(state multistep.StateBag) multistep.StepAction {
ui
.
Say
(
"Executing custom VBoxManage commands..."
)
ui
.
Say
(
"Executing custom VBoxManage commands..."
)
}
}
tplData
:
=
&
commandTemplate
{
s
.
Ctx
.
Data
=
&
commandTemplate
{
Name
:
vmName
,
Name
:
vmName
,
}
}
...
@@ -44,7 +46,7 @@ func (s *StepVBoxManage) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -44,7 +46,7 @@ func (s *StepVBoxManage) Run(state multistep.StateBag) multistep.StepAction {
for
i
,
arg
:=
range
command
{
for
i
,
arg
:=
range
command
{
var
err
error
var
err
error
command
[
i
],
err
=
s
.
Tpl
.
Process
(
arg
,
tplData
)
command
[
i
],
err
=
interpolate
.
Render
(
arg
,
&
s
.
Ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error preparing vboxmanage command: %s"
,
err
)
err
:=
fmt
.
Errorf
(
"Error preparing vboxmanage command: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
state
.
Put
(
"error"
,
err
)
...
...
builder/virtualbox/common/vbox_version_config.go
View file @
d15bc904
package
common
package
common
import
(
import
(
"fmt"
"github.com/mitchellh/packer/template/interpolate"
"github.com/mitchellh/packer/packer"
)
)
type
VBoxVersionConfig
struct
{
type
VBoxVersionConfig
struct
{
VBoxVersionFile
string
`mapstructure:"virtualbox_version_file"`
VBoxVersionFile
string
`mapstructure:"virtualbox_version_file"`
}
}
func
(
c
*
VBoxVersionConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
func
(
c
*
VBoxVersionConfig
)
Prepare
(
ctx
*
interpolate
.
Context
)
[]
error
{
if
c
.
VBoxVersionFile
==
""
{
if
c
.
VBoxVersionFile
==
""
{
c
.
VBoxVersionFile
=
".vbox_version"
c
.
VBoxVersionFile
=
".vbox_version"
}
}
templates
:=
map
[
string
]
*
string
{
return
nil
"virtualbox_version_file"
:
&
c
.
VBoxVersionFile
,
}
errs
:=
make
([]
error
,
0
)
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
t
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
return
errs
}
}
builder/virtualbox/common/vboxmanage_config.go
View file @
d15bc904
package
common
package
common
import
(
import
(
"fmt"
"github.com/mitchellh/packer/template/interpolate"
"github.com/mitchellh/packer/packer"
)
)
type
VBoxManageConfig
struct
{
type
VBoxManageConfig
struct
{
VBoxManage
[][]
string
`mapstructure:"vboxmanage"`
VBoxManage
[][]
string
`mapstructure:"vboxmanage"`
}
}
func
(
c
*
VBoxManageConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
func
(
c
*
VBoxManageConfig
)
Prepare
(
ctx
*
interpolate
.
Context
)
[]
error
{
if
c
.
VBoxManage
==
nil
{
if
c
.
VBoxManage
==
nil
{
c
.
VBoxManage
=
make
([][]
string
,
0
)
c
.
VBoxManage
=
make
([][]
string
,
0
)
}
}
errs
:=
make
([]
error
,
0
)
return
nil
for
i
,
args
:=
range
c
.
VBoxManage
{
for
j
,
arg
:=
range
args
{
if
err
:=
t
.
Validate
(
arg
);
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing vboxmanage[%d][%d]: %s"
,
i
,
j
,
err
))
}
}
}
return
errs
}
}
builder/virtualbox/common/vboxmanage_post_config.go
View file @
d15bc904
package
common
package
common
import
(
import
(
"fmt"
"github.com/mitchellh/packer/template/interpolate"
"github.com/mitchellh/packer/packer"
)
)
type
VBoxManagePostConfig
struct
{
type
VBoxManagePostConfig
struct
{
VBoxManagePost
[][]
string
`mapstructure:"vboxmanage_post"`
VBoxManagePost
[][]
string
`mapstructure:"vboxmanage_post"`
}
}
func
(
c
*
VBoxManagePostConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
func
(
c
*
VBoxManagePostConfig
)
Prepare
(
ctx
*
interpolate
.
Context
)
[]
error
{
if
c
.
VBoxManagePost
==
nil
{
if
c
.
VBoxManagePost
==
nil
{
c
.
VBoxManagePost
=
make
([][]
string
,
0
)
c
.
VBoxManagePost
=
make
([][]
string
,
0
)
}
}
errs
:=
make
([]
error
,
0
)
return
nil
for
i
,
args
:=
range
c
.
VBoxManagePost
{
for
j
,
arg
:=
range
args
{
if
err
:=
t
.
Validate
(
arg
);
err
!=
nil
{
errs
=
append
(
errs
,
fmt
.
Errorf
(
"Error processing vboxmanage_post[%d][%d]: %s"
,
i
,
j
,
err
))
}
}
}
return
errs
}
}
builder/virtualbox/iso/builder.go
View file @
d15bc904
...
@@ -11,17 +11,19 @@ import (
...
@@ -11,17 +11,19 @@ import (
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
vboxcommon
"github.com/mitchellh/packer/builder/virtualbox/common"
vboxcommon
"github.com/mitchellh/packer/builder/virtualbox/common"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/helper/config"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/template/interpolate"
)
)
const
BuilderId
=
"mitchellh.virtualbox"
const
BuilderId
=
"mitchellh.virtualbox"
type
Builder
struct
{
type
Builder
struct
{
config
c
onfig
config
C
onfig
runner
multistep
.
Runner
runner
multistep
.
Runner
}
}
type
c
onfig
struct
{
type
C
onfig
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
common
.
PackerConfig
`mapstructure:",squash"`
vboxcommon
.
ExportConfig
`mapstructure:",squash"`
vboxcommon
.
ExportConfig
`mapstructure:",squash"`
vboxcommon
.
ExportOpts
`mapstructure:",squash"`
vboxcommon
.
ExportOpts
`mapstructure:",squash"`
...
@@ -50,34 +52,39 @@ type config struct {
...
@@ -50,34 +52,39 @@ type config struct {
RawSingleISOUrl
string
`mapstructure:"iso_url"`
RawSingleISOUrl
string
`mapstructure:"iso_url"`
tpl
*
packer
.
ConfigTemplate
ctx
interpolate
.
Context
}
}
func
(
b
*
Builder
)
Prepare
(
raws
...
interface
{})
([]
string
,
error
)
{
func
(
b
*
Builder
)
Prepare
(
raws
...
interface
{})
([]
string
,
error
)
{
md
,
err
:=
common
.
DecodeConfig
(
&
b
.
config
,
raws
...
)
err
:=
config
.
Decode
(
&
b
.
config
,
&
config
.
DecodeOpts
{
if
err
!=
nil
{
Interpolate
:
true
,
return
nil
,
err
InterpolateFilter
:
&
interpolate
.
RenderFilter
{
}
Exclude
:
[]
string
{
"boot_command"
,
b
.
config
.
tpl
,
err
=
packer
.
NewConfigTemplate
()
"guest_additions_path"
,
"guest_additions_url"
,
"vboxmanage"
,
"vboxmanage_post"
,
},
},
},
raws
...
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
b
.
config
.
tpl
.
UserVars
=
b
.
config
.
PackerUserVars
// Accumulate any errors and warnings
// Accumulate any errors and warnings
errs
:=
common
.
CheckUnusedConfig
(
md
)
var
errs
*
packer
.
MultiError
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
ExportConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
ExportConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
ExportOpts
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
ExportOpts
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
FloppyConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
FloppyConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
OutputConfig
.
Prepare
(
b
.
config
.
tpl
,
&
b
.
config
.
PackerConfig
)
...
)
errs
,
b
.
config
.
OutputConfig
.
Prepare
(
&
b
.
config
.
ctx
,
&
b
.
config
.
PackerConfig
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
RunConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
RunConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
ShutdownConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
ShutdownConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
SSHConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
SSHConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
VBoxManageConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
VBoxManageConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
VBoxManagePostConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
VBoxManagePostConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
VBoxVersionConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
VBoxVersionConfig
.
Prepare
(
&
b
.
config
.
ctx
)
...
)
warnings
:=
make
([]
string
,
0
)
warnings
:=
make
([]
string
,
0
)
if
b
.
config
.
DiskSize
==
0
{
if
b
.
config
.
DiskSize
==
0
{
...
@@ -108,56 +115,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
...
@@ -108,56 +115,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
b
.
config
.
VMName
=
fmt
.
Sprintf
(
"packer-%s-{{timestamp}}"
,
b
.
config
.
PackerBuildName
)
b
.
config
.
VMName
=
fmt
.
Sprintf
(
"packer-%s-{{timestamp}}"
,
b
.
config
.
PackerBuildName
)
}
}
// Errors
templates
:=
map
[
string
]
*
string
{
"guest_additions_mode"
:
&
b
.
config
.
GuestAdditionsMode
,
"guest_additions_sha256"
:
&
b
.
config
.
GuestAdditionsSHA256
,
"guest_os_type"
:
&
b
.
config
.
GuestOSType
,
"hard_drive_interface"
:
&
b
.
config
.
HardDriveInterface
,
"iso_checksum"
:
&
b
.
config
.
ISOChecksum
,
"iso_checksum_type"
:
&
b
.
config
.
ISOChecksumType
,
"iso_interface"
:
&
b
.
config
.
ISOInterface
,
"iso_url"
:
&
b
.
config
.
RawSingleISOUrl
,
"vm_name"
:
&
b
.
config
.
VMName
,
}
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
b
.
config
.
tpl
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
for
i
,
url
:=
range
b
.
config
.
ISOUrls
{
var
err
error
b
.
config
.
ISOUrls
[
i
],
err
=
b
.
config
.
tpl
.
Process
(
url
,
nil
)
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing iso_urls[%d]: %s"
,
i
,
err
))
}
}
validates
:=
map
[
string
]
*
string
{
"guest_additions_path"
:
&
b
.
config
.
GuestAdditionsPath
,
"guest_additions_url"
:
&
b
.
config
.
GuestAdditionsURL
,
}
for
n
,
ptr
:=
range
validates
{
if
err
:=
b
.
config
.
tpl
.
Validate
(
*
ptr
);
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error parsing %s: %s"
,
n
,
err
))
}
}
for
i
,
command
:=
range
b
.
config
.
BootCommand
{
if
err
:=
b
.
config
.
tpl
.
Validate
(
command
);
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing boot_command[%d]: %s"
,
i
,
err
))
}
}
if
b
.
config
.
HardDriveInterface
!=
"ide"
&&
b
.
config
.
HardDriveInterface
!=
"sata"
&&
b
.
config
.
HardDriveInterface
!=
"scsi"
{
if
b
.
config
.
HardDriveInterface
!=
"ide"
&&
b
.
config
.
HardDriveInterface
!=
"sata"
&&
b
.
config
.
HardDriveInterface
!=
"scsi"
{
errs
=
packer
.
MultiErrorAppend
(
errs
=
packer
.
MultiErrorAppend
(
errs
,
errors
.
New
(
"hard_drive_interface can only be ide, sata, or scsi"
))
errs
,
errors
.
New
(
"hard_drive_interface can only be ide, sata, or scsi"
))
...
@@ -265,7 +222,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -265,7 +222,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
GuestAdditionsMode
:
b
.
config
.
GuestAdditionsMode
,
GuestAdditionsMode
:
b
.
config
.
GuestAdditionsMode
,
GuestAdditionsURL
:
b
.
config
.
GuestAdditionsURL
,
GuestAdditionsURL
:
b
.
config
.
GuestAdditionsURL
,
GuestAdditionsSHA256
:
b
.
config
.
GuestAdditionsSHA256
,
GuestAdditionsSHA256
:
b
.
config
.
GuestAdditionsSHA256
,
Tpl
:
b
.
config
.
tpl
,
Ctx
:
b
.
config
.
ctx
,
},
},
&
common
.
StepDownload
{
&
common
.
StepDownload
{
Checksum
:
b
.
config
.
ISOChecksum
,
Checksum
:
b
.
config
.
ISOChecksum
,
...
@@ -301,7 +258,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -301,7 +258,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
},
},
&
vboxcommon
.
StepVBoxManage
{
&
vboxcommon
.
StepVBoxManage
{
Commands
:
b
.
config
.
VBoxManage
,
Commands
:
b
.
config
.
VBoxManage
,
Tpl
:
b
.
config
.
tpl
,
Ctx
:
b
.
config
.
ctx
,
},
},
&
vboxcommon
.
StepRun
{
&
vboxcommon
.
StepRun
{
BootWait
:
b
.
config
.
BootWait
,
BootWait
:
b
.
config
.
BootWait
,
...
@@ -310,7 +267,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -310,7 +267,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&
vboxcommon
.
StepTypeBootCommand
{
&
vboxcommon
.
StepTypeBootCommand
{
BootCommand
:
b
.
config
.
BootCommand
,
BootCommand
:
b
.
config
.
BootCommand
,
VMName
:
b
.
config
.
VMName
,
VMName
:
b
.
config
.
VMName
,
Tpl
:
b
.
config
.
tpl
,
Ctx
:
b
.
config
.
ctx
,
},
},
&
common
.
StepConnectSSH
{
&
common
.
StepConnectSSH
{
SSHAddress
:
vboxcommon
.
SSHAddress
,
SSHAddress
:
vboxcommon
.
SSHAddress
,
...
@@ -323,7 +280,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -323,7 +280,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&
vboxcommon
.
StepUploadGuestAdditions
{
&
vboxcommon
.
StepUploadGuestAdditions
{
GuestAdditionsMode
:
b
.
config
.
GuestAdditionsMode
,
GuestAdditionsMode
:
b
.
config
.
GuestAdditionsMode
,
GuestAdditionsPath
:
b
.
config
.
GuestAdditionsPath
,
GuestAdditionsPath
:
b
.
config
.
GuestAdditionsPath
,
Tpl
:
b
.
config
.
tpl
,
Ctx
:
b
.
config
.
ctx
,
},
},
new
(
common
.
StepProvision
),
new
(
common
.
StepProvision
),
&
vboxcommon
.
StepShutdown
{
&
vboxcommon
.
StepShutdown
{
...
@@ -333,7 +290,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -333,7 +290,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
new
(
vboxcommon
.
StepRemoveDevices
),
new
(
vboxcommon
.
StepRemoveDevices
),
&
vboxcommon
.
StepVBoxManage
{
&
vboxcommon
.
StepVBoxManage
{
Commands
:
b
.
config
.
VBoxManagePost
,
Commands
:
b
.
config
.
VBoxManagePost
,
Tpl
:
b
.
config
.
tpl
,
Ctx
:
b
.
config
.
ctx
,
},
},
&
vboxcommon
.
StepExport
{
&
vboxcommon
.
StepExport
{
Format
:
b
.
config
.
Format
,
Format
:
b
.
config
.
Format
,
...
...
builder/virtualbox/iso/step_attach_iso.go
View file @
d15bc904
...
@@ -17,7 +17,7 @@ type stepAttachISO struct {
...
@@ -17,7 +17,7 @@ type stepAttachISO struct {
}
}
func
(
s
*
stepAttachISO
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
stepAttachISO
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
c
onfig
)
config
:=
state
.
Get
(
"config"
)
.
(
*
C
onfig
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vboxcommon
.
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vboxcommon
.
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
)
...
@@ -65,7 +65,7 @@ func (s *stepAttachISO) Cleanup(state multistep.StateBag) {
...
@@ -65,7 +65,7 @@ func (s *stepAttachISO) Cleanup(state multistep.StateBag) {
return
return
}
}
config
:=
state
.
Get
(
"config"
)
.
(
*
c
onfig
)
config
:=
state
.
Get
(
"config"
)
.
(
*
C
onfig
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vboxcommon
.
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vboxcommon
.
Driver
)
vmName
:=
state
.
Get
(
"vmName"
)
.
(
string
)
vmName
:=
state
.
Get
(
"vmName"
)
.
(
string
)
...
...
builder/virtualbox/iso/step_create_disk.go
View file @
d15bc904
...
@@ -15,7 +15,7 @@ import (
...
@@ -15,7 +15,7 @@ import (
type
stepCreateDisk
struct
{}
type
stepCreateDisk
struct
{}
func
(
s
*
stepCreateDisk
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
stepCreateDisk
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
c
onfig
)
config
:=
state
.
Get
(
"config"
)
.
(
*
C
onfig
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vboxcommon
.
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vboxcommon
.
Driver
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
vmName
:=
state
.
Get
(
"vmName"
)
.
(
string
)
vmName
:=
state
.
Get
(
"vmName"
)
.
(
string
)
...
...
builder/virtualbox/iso/step_create_vm.go
View file @
d15bc904
...
@@ -17,7 +17,7 @@ type stepCreateVM struct {
...
@@ -17,7 +17,7 @@ type stepCreateVM struct {
}
}
func
(
s
*
stepCreateVM
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
stepCreateVM
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
c
onfig
)
config
:=
state
.
Get
(
"config"
)
.
(
*
C
onfig
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vboxcommon
.
Driver
)
driver
:=
state
.
Get
(
"driver"
)
.
(
vboxcommon
.
Driver
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
...
...
builder/virtualbox/iso/step_http_server.go
View file @
d15bc904
...
@@ -25,7 +25,7 @@ type stepHTTPServer struct {
...
@@ -25,7 +25,7 @@ type stepHTTPServer struct {
}
}
func
(
s
*
stepHTTPServer
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
func
(
s
*
stepHTTPServer
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
config
:=
state
.
Get
(
"config"
)
.
(
*
c
onfig
)
config
:=
state
.
Get
(
"config"
)
.
(
*
C
onfig
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
var
httpPort
uint
=
0
var
httpPort
uint
=
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment