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
aa954c94
Commit
aa954c94
authored
Jun 24, 2015
by
Marc Siegfriedt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated how vmx entries are handled
parent
f765d570
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
builder/vmware/common/step_configure_vmx.go
builder/vmware/common/step_configure_vmx.go
+0
-2
builder/vmware/common/vmx.go
builder/vmware/common/vmx.go
+16
-4
No files found.
builder/vmware/common/step_configure_vmx.go
100644 → 100755
View file @
aa954c94
...
@@ -5,7 +5,6 @@ import (
...
@@ -5,7 +5,6 @@ import (
"io/ioutil"
"io/ioutil"
"log"
"log"
"regexp"
"regexp"
"strings"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
...
@@ -53,7 +52,6 @@ func (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -53,7 +52,6 @@ func (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction {
// Set custom data
// Set custom data
for
k
,
v
:=
range
s
.
CustomData
{
for
k
,
v
:=
range
s
.
CustomData
{
log
.
Printf
(
"Setting VMX: '%s' = '%s'"
,
k
,
v
)
log
.
Printf
(
"Setting VMX: '%s' = '%s'"
,
k
,
v
)
k
=
strings
.
ToLower
(
k
)
vmxData
[
k
]
=
v
vmxData
[
k
]
=
v
}
}
...
...
builder/vmware/common/vmx.go
100644 → 100755
View file @
aa954c94
...
@@ -17,7 +17,7 @@ import (
...
@@ -17,7 +17,7 @@ import (
func
ParseVMX
(
contents
string
)
map
[
string
]
string
{
func
ParseVMX
(
contents
string
)
map
[
string
]
string
{
results
:=
make
(
map
[
string
]
string
)
results
:=
make
(
map
[
string
]
string
)
lineRe
:=
regexp
.
MustCompile
(
`^(.+?)\s*=\s*"
(.*?)"
\s*$`
)
lineRe
:=
regexp
.
MustCompile
(
`^(.+?)\s*=\s*"
?(.*?)"?
\s*$`
)
for
_
,
line
:=
range
strings
.
Split
(
contents
,
"
\n
"
)
{
for
_
,
line
:=
range
strings
.
Split
(
contents
,
"
\n
"
)
{
matches
:=
lineRe
.
FindStringSubmatch
(
line
)
matches
:=
lineRe
.
FindStringSubmatch
(
line
)
...
@@ -25,8 +25,7 @@ func ParseVMX(contents string) map[string]string {
...
@@ -25,8 +25,7 @@ func ParseVMX(contents string) map[string]string {
continue
continue
}
}
key
:=
strings
.
ToLower
(
matches
[
1
])
results
[
matches
[
1
]]
=
matches
[
2
]
results
[
key
]
=
matches
[
2
]
}
}
return
results
return
results
...
@@ -43,9 +42,22 @@ func EncodeVMX(contents map[string]string) string {
...
@@ -43,9 +42,22 @@ func EncodeVMX(contents map[string]string) string {
i
++
i
++
}
}
// a list of VMX key fragments that should not be wrapped in quotes,
// fragments because multiple disks can use the virtualSSD suffix
noQuotes
:=
[]
string
{
"virtualSSD"
,
}
sort
.
Strings
(
keys
)
sort
.
Strings
(
keys
)
for
_
,
k
:=
range
keys
{
for
_
,
k
:=
range
keys
{
buf
.
WriteString
(
fmt
.
Sprintf
(
"%s =
\"
%s
\"\n
"
,
k
,
contents
[
k
]))
pat
:=
"%s =
\"
%s
\"\n
"
for
_
,
q
:=
range
noQuotes
{
if
strings
.
Contains
(
k
,
q
)
{
pat
=
"%s = %s
\n
"
break
;
}
}
buf
.
WriteString
(
fmt
.
Sprintf
(
pat
,
k
,
contents
[
k
]))
}
}
return
buf
.
String
()
return
buf
.
String
()
...
...
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