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
b81bd74a
Commit
b81bd74a
authored
Aug 10, 2015
by
Chris Bednarski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2578 from mitchellh/b-vmware-bc-break
Revert backwards-compatibility break in VMX option casing
parents
fce6f863
313fcaf0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
36 deletions
+27
-36
builder/vmware/common/ssh.go
builder/vmware/common/ssh.go
+1
-1
builder/vmware/common/step_clean_vmx.go
builder/vmware/common/step_clean_vmx.go
+5
-4
builder/vmware/common/step_clean_vmx_test.go
builder/vmware/common/step_clean_vmx_test.go
+9
-9
builder/vmware/common/step_configure_vmx.go
builder/vmware/common/step_configure_vmx.go
+2
-0
builder/vmware/common/vmx.go
builder/vmware/common/vmx.go
+4
-16
builder/vmware/vmx/step_clone_vmx.go
builder/vmware/vmx/step_clone_vmx.go
+6
-6
No files found.
builder/vmware/common/ssh.go
View file @
b81bd74a
...
...
@@ -39,7 +39,7 @@ func CommHost(config *SSHConfig) func(multistep.StateBag) (string, error) {
var
ok
bool
macAddress
:=
""
if
macAddress
,
ok
=
vmxData
[
"ethernet0.address"
];
!
ok
||
macAddress
==
""
{
if
macAddress
,
ok
=
vmxData
[
"ethernet0.generated
A
ddress"
];
!
ok
||
macAddress
==
""
{
if
macAddress
,
ok
=
vmxData
[
"ethernet0.generated
a
ddress"
];
!
ok
||
macAddress
==
""
{
return
""
,
errors
.
New
(
"couldn't find MAC address in VMX"
)
}
}
...
...
builder/vmware/common/step_clean_vmx.go
View file @
b81bd74a
...
...
@@ -2,11 +2,12 @@ package common
import
(
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"log"
"regexp"
"strings"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
// This step cleans up the VMX by removing or changing this prior to
...
...
@@ -51,8 +52,8 @@ func (s StepCleanVMX) Run(state multistep.StateBag) multistep.StepAction {
ui
.
Message
(
"Detaching ISO from CD-ROM device..."
)
vmxData
[
ide
+
"device
T
ype"
]
=
"cdrom-raw"
vmxData
[
ide
+
"file
N
ame"
]
=
"auto detect"
vmxData
[
ide
+
"device
t
ype"
]
=
"cdrom-raw"
vmxData
[
ide
+
"file
n
ame"
]
=
"auto detect"
}
ui
.
Message
(
"Disabling VNC server..."
)
...
...
builder/vmware/common/step_clean_vmx_test.go
View file @
b81bd74a
...
...
@@ -61,8 +61,8 @@ func TestStepCleanVMX_floppyPath(t *testing.T) {
Value
string
}{
{
"floppy0.present"
,
"FALSE"
},
{
"floppy0.file
T
ype"
,
""
},
{
"floppy0.file
N
ame"
,
""
},
{
"floppy0.file
t
ype"
,
""
},
{
"floppy0.file
n
ame"
,
""
},
}
for
_
,
tc
:=
range
cases
{
...
...
@@ -109,9 +109,9 @@ func TestStepCleanVMX_isoPath(t *testing.T) {
Key
string
Value
string
}{
{
"ide0:0.file
N
ame"
,
"auto detect"
},
{
"ide0:0.device
T
ype"
,
"cdrom-raw"
},
{
"ide0:1.file
N
ame"
,
"bar"
},
{
"ide0:0.file
n
ame"
,
"auto detect"
},
{
"ide0:0.device
t
ype"
,
"cdrom-raw"
},
{
"ide0:1.file
n
ame"
,
"bar"
},
{
"foo"
,
"bar"
},
}
...
...
@@ -130,12 +130,12 @@ func TestStepCleanVMX_isoPath(t *testing.T) {
const
testVMXFloppyPath
=
`
floppy0.present = "TRUE"
floppy0.file
T
ype = "file"
floppy0.file
t
ype = "file"
`
const
testVMXISOPath
=
`
ide0:0.device
T
ype = "cdrom-image"
ide0:0.file
N
ame = "foo"
ide0:1.file
N
ame = "bar"
ide0:0.device
t
ype = "cdrom-image"
ide0:0.file
n
ame = "foo"
ide0:1.file
n
ame = "bar"
foo = "bar"
`
builder/vmware/common/step_configure_vmx.go
View file @
b81bd74a
...
...
@@ -5,6 +5,7 @@ import (
"io/ioutil"
"log"
"regexp"
"strings"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
...
...
@@ -52,6 +53,7 @@ func (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction {
// Set custom data
for
k
,
v
:=
range
s
.
CustomData
{
log
.
Printf
(
"Setting VMX: '%s' = '%s'"
,
k
,
v
)
k
=
strings
.
ToLower
(
k
)
vmxData
[
k
]
=
v
}
...
...
builder/vmware/common/vmx.go
View file @
b81bd74a
...
...
@@ -17,7 +17,7 @@ import (
func
ParseVMX
(
contents
string
)
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
"
)
{
matches
:=
lineRe
.
FindStringSubmatch
(
line
)
...
...
@@ -25,7 +25,8 @@ func ParseVMX(contents string) map[string]string {
continue
}
results
[
matches
[
1
]]
=
matches
[
2
]
key
:=
strings
.
ToLower
(
matches
[
1
])
results
[
key
]
=
matches
[
2
]
}
return
results
...
...
@@ -42,22 +43,9 @@ func EncodeVMX(contents map[string]string) string {
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
)
for
_
,
k
:=
range
keys
{
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
]))
buf
.
WriteString
(
fmt
.
Sprintf
(
"%s =
\"
%s
\"\n
"
,
k
,
contents
[
k
]))
}
return
buf
.
String
()
...
...
builder/vmware/vmx/step_clone_vmx.go
View file @
b81bd74a
...
...
@@ -38,14 +38,14 @@ func (s *StepCloneVMX) Run(state multistep.StateBag) multistep.StepAction {
}
var
diskName
string
if
_
,
ok
:=
vmxData
[
"scsi0:0.file
N
ame"
];
ok
{
diskName
=
vmxData
[
"scsi0:0.file
N
ame"
]
if
_
,
ok
:=
vmxData
[
"scsi0:0.file
n
ame"
];
ok
{
diskName
=
vmxData
[
"scsi0:0.file
n
ame"
]
}
if
_
,
ok
:=
vmxData
[
"sata0:0.file
N
ame"
];
ok
{
diskName
=
vmxData
[
"sata0:0.file
N
ame"
]
if
_
,
ok
:=
vmxData
[
"sata0:0.file
n
ame"
];
ok
{
diskName
=
vmxData
[
"sata0:0.file
n
ame"
]
}
if
_
,
ok
:=
vmxData
[
"ide0:0.file
N
ame"
];
ok
{
diskName
=
vmxData
[
"ide0:0.file
N
ame"
]
if
_
,
ok
:=
vmxData
[
"ide0:0.file
n
ame"
];
ok
{
diskName
=
vmxData
[
"ide0:0.file
n
ame"
]
}
if
diskName
==
""
{
err
:=
fmt
.
Errorf
(
"Root disk filename could not be found!"
)
...
...
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