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
83138569
Commit
83138569
authored
May 12, 2014
by
Ross Smith II
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware-vmx: add floppy_files support
parent
38d1d7fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
builder/vmware/vmx/builder_test.go
builder/vmware/vmx/builder_test.go
+49
-0
builder/vmware/vmx/config.go
builder/vmware/vmx/config.go
+10
-0
No files found.
builder/vmware/vmx/builder_test.go
View file @
83138569
package
vmx
import
(
"io/ioutil"
"os"
"reflect"
"testing"
)
func
TestBuilderPrepare_FloppyFiles
(
t
*
testing
.
T
)
{
var
b
Builder
tf
,
err
:=
ioutil
.
TempFile
(
""
,
"packer"
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
tf
.
Close
()
defer
os
.
Remove
(
tf
.
Name
())
config
:=
testConfig
(
t
)
config
[
"source_path"
]
=
tf
.
Name
()
delete
(
config
,
"floppy_files"
)
warns
,
err
:=
b
.
Prepare
(
config
)
if
len
(
warns
)
>
0
{
t
.
Fatalf
(
"bad: %#v"
,
warns
)
}
if
err
!=
nil
{
t
.
Fatalf
(
"bad err: %s"
,
err
)
}
if
len
(
b
.
config
.
FloppyFiles
)
!=
0
{
t
.
Fatalf
(
"bad: %#v"
,
b
.
config
.
FloppyFiles
)
}
config
[
"floppy_files"
]
=
[]
string
{
"foo"
,
"bar"
}
b
=
Builder
{}
warns
,
err
=
b
.
Prepare
(
config
)
if
len
(
warns
)
>
0
{
t
.
Fatalf
(
"bad: %#v"
,
warns
)
}
if
err
!=
nil
{
t
.
Fatalf
(
"should not have error: %s"
,
err
)
}
expected
:=
[]
string
{
"foo"
,
"bar"
}
if
!
reflect
.
DeepEqual
(
b
.
config
.
FloppyFiles
,
expected
)
{
t
.
Fatalf
(
"bad: %#v"
,
b
.
config
.
FloppyFiles
)
}
}
builder/vmware/vmx/config.go
View file @
83138569
...
...
@@ -72,6 +72,16 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
}
}
for
i
,
file
:=
range
c
.
FloppyFiles
{
var
err
error
c
.
FloppyFiles
[
i
],
err
=
c
.
tpl
.
Process
(
file
,
nil
)
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing floppy_files[%d]: %s"
,
i
,
err
))
}
}
if
c
.
SourcePath
==
""
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"source_path is required"
))
}
else
{
...
...
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