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
dbad270d
Commit
dbad270d
authored
Jul 09, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: remove floppy drive before exporting
parent
3a420478
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
builder/virtualbox/step_attach_floppy.go
builder/virtualbox/step_attach_floppy.go
+1
-2
builder/virtualbox/step_export.go
builder/virtualbox/step_export.go
+19
-1
No files found.
builder/virtualbox/step_attach_floppy.go
View file @
dbad270d
...
@@ -85,7 +85,6 @@ func (s *stepAttachFloppy) Cleanup(state map[string]interface{}) {
...
@@ -85,7 +85,6 @@ func (s *stepAttachFloppy) Cleanup(state map[string]interface{}) {
defer
os
.
Remove
(
s
.
floppyPath
)
defer
os
.
Remove
(
s
.
floppyPath
)
driver
:=
state
[
"driver"
]
.
(
Driver
)
driver
:=
state
[
"driver"
]
.
(
Driver
)
ui
:=
state
[
"ui"
]
.
(
packer
.
Ui
)
vmName
:=
state
[
"vmName"
]
.
(
string
)
vmName
:=
state
[
"vmName"
]
.
(
string
)
command
:=
[]
string
{
command
:=
[]
string
{
...
@@ -97,7 +96,7 @@ func (s *stepAttachFloppy) Cleanup(state map[string]interface{}) {
...
@@ -97,7 +96,7 @@ func (s *stepAttachFloppy) Cleanup(state map[string]interface{}) {
}
}
if
err
:=
driver
.
VBoxManage
(
command
...
);
err
!=
nil
{
if
err
:=
driver
.
VBoxManage
(
command
...
);
err
!=
nil
{
ui
.
Error
(
fmt
.
Sprintf
(
"Error unregistering floppy: %s"
,
err
)
)
log
.
Printf
(
"Error unregistering floppy: %s"
,
err
)
}
}
}
}
...
...
builder/virtualbox/step_export.go
View file @
dbad270d
...
@@ -22,7 +22,8 @@ func (s *stepExport) Run(state map[string]interface{}) multistep.StepAction {
...
@@ -22,7 +22,8 @@ func (s *stepExport) Run(state map[string]interface{}) multistep.StepAction {
vmName
:=
state
[
"vmName"
]
.
(
string
)
vmName
:=
state
[
"vmName"
]
.
(
string
)
// Clear out the Packer-created forwarding rule
// Clear out the Packer-created forwarding rule
ui
.
Say
(
fmt
.
Sprintf
(
"Deleting forwarded port mapping for SSH (host port %d)"
,
state
[
"sshHostPort"
]))
ui
.
Say
(
"Preparing to export machine..."
)
ui
.
Message
(
fmt
.
Sprintf
(
"Deleting forwarded port mapping for SSH (host port %d)"
,
state
[
"sshHostPort"
]))
command
:=
[]
string
{
"modifyvm"
,
vmName
,
"--natpf1"
,
"delete"
,
"packerssh"
}
command
:=
[]
string
{
"modifyvm"
,
vmName
,
"--natpf1"
,
"delete"
,
"packerssh"
}
if
err
:=
driver
.
VBoxManage
(
command
...
);
err
!=
nil
{
if
err
:=
driver
.
VBoxManage
(
command
...
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error deleting port forwarding rule: %s"
,
err
)
err
:=
fmt
.
Errorf
(
"Error deleting port forwarding rule: %s"
,
err
)
...
@@ -31,6 +32,23 @@ func (s *stepExport) Run(state map[string]interface{}) multistep.StepAction {
...
@@ -31,6 +32,23 @@ func (s *stepExport) Run(state map[string]interface{}) multistep.StepAction {
return
multistep
.
ActionHalt
return
multistep
.
ActionHalt
}
}
// Remove the attached floppy disk, if it exists
if
_
,
ok
:=
state
[
"floppy_path"
];
ok
{
ui
.
Message
(
"Removing floppy drive..."
)
command
:=
[]
string
{
"storageattach"
,
vmName
,
"--storagectl"
,
"Floppy Controller"
,
"--port"
,
"0"
,
"--device"
,
"0"
,
"--medium"
,
"none"
,
}
if
err
:=
driver
.
VBoxManage
(
command
...
);
err
!=
nil
{
state
[
"error"
]
=
fmt
.
Errorf
(
"Error removing floppy: %s"
,
err
)
return
multistep
.
ActionHalt
}
}
// Export the VM to an OVF
// Export the VM to an OVF
outputPath
:=
filepath
.
Join
(
config
.
OutputDir
,
"packer.ovf"
)
outputPath
:=
filepath
.
Join
(
config
.
OutputDir
,
"packer.ovf"
)
...
...
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