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
6ff38c86
Commit
6ff38c86
authored
Jun 12, 2014
by
Yuya Kusakabe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1244, Add a check for upload iso hash to ESXi Driver
parent
dbb6151b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
4 deletions
+14
-4
builder/vmware/iso/driver_esx5.go
builder/vmware/iso/driver_esx5.go
+7
-1
builder/vmware/iso/remote_driver.go
builder/vmware/iso/remote_driver.go
+1
-1
builder/vmware/iso/remote_driver_mock.go
builder/vmware/iso/remote_driver_mock.go
+1
-1
builder/vmware/iso/step_remote_upload.go
builder/vmware/iso/step_remote_upload.go
+5
-1
No files found.
builder/vmware/iso/driver_esx5.go
View file @
6ff38c86
...
@@ -84,7 +84,7 @@ func (d *ESX5Driver) Unregister(vmxPathLocal string) error {
...
@@ -84,7 +84,7 @@ func (d *ESX5Driver) Unregister(vmxPathLocal string) error {
return
d
.
sh
(
"vim-cmd"
,
"vmsvc/unregister"
,
d
.
vmId
)
return
d
.
sh
(
"vim-cmd"
,
"vmsvc/unregister"
,
d
.
vmId
)
}
}
func
(
d
*
ESX5Driver
)
UploadISO
(
localPath
string
)
(
string
,
error
)
{
func
(
d
*
ESX5Driver
)
UploadISO
(
localPath
string
,
checksum
string
,
checksumType
string
)
(
string
,
error
)
{
cacheRoot
,
_
:=
filepath
.
Abs
(
"."
)
cacheRoot
,
_
:=
filepath
.
Abs
(
"."
)
targetFile
,
err
:=
filepath
.
Rel
(
cacheRoot
,
localPath
)
targetFile
,
err
:=
filepath
.
Rel
(
cacheRoot
,
localPath
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -96,6 +96,12 @@ func (d *ESX5Driver) UploadISO(localPath string) (string, error) {
...
@@ -96,6 +96,12 @@ func (d *ESX5Driver) UploadISO(localPath string) (string, error) {
return
""
,
err
return
""
,
err
}
}
log
.
Printf
(
"Verifying checksum of %s"
,
finalPath
)
if
d
.
verifyChecksum
(
checksumType
,
checksum
,
finalPath
)
{
log
.
Println
(
"Initial checksum matched, no upload needed."
)
return
finalPath
,
nil
}
if
err
:=
d
.
upload
(
finalPath
,
localPath
);
err
!=
nil
{
if
err
:=
d
.
upload
(
finalPath
,
localPath
);
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
...
builder/vmware/iso/remote_driver.go
View file @
6ff38c86
...
@@ -10,7 +10,7 @@ type RemoteDriver interface {
...
@@ -10,7 +10,7 @@ type RemoteDriver interface {
// UploadISO uploads a local ISO to the remote side and returns the
// UploadISO uploads a local ISO to the remote side and returns the
// new path that should be used in the VMX along with an error if it
// new path that should be used in the VMX along with an error if it
// exists.
// exists.
UploadISO
(
string
)
(
string
,
error
)
UploadISO
(
string
,
string
,
string
)
(
string
,
error
)
// Adds a VM to inventory specified by the path to the VMX given.
// Adds a VM to inventory specified by the path to the VMX given.
Register
(
string
)
error
Register
(
string
)
error
...
...
builder/vmware/iso/remote_driver_mock.go
View file @
6ff38c86
...
@@ -21,7 +21,7 @@ type RemoteDriverMock struct {
...
@@ -21,7 +21,7 @@ type RemoteDriverMock struct {
UnregisterErr
error
UnregisterErr
error
}
}
func
(
d
*
RemoteDriverMock
)
UploadISO
(
path
string
)
(
string
,
error
)
{
func
(
d
*
RemoteDriverMock
)
UploadISO
(
path
string
,
checksum
string
,
checksumType
string
)
(
string
,
error
)
{
d
.
UploadISOCalled
=
true
d
.
UploadISOCalled
=
true
d
.
UploadISOPath
=
path
d
.
UploadISOPath
=
path
return
d
.
UploadISOResult
,
d
.
UploadISOErr
return
d
.
UploadISOResult
,
d
.
UploadISOErr
...
...
builder/vmware/iso/step_remote_upload.go
View file @
6ff38c86
...
@@ -29,9 +29,13 @@ func (s *stepRemoteUpload) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -29,9 +29,13 @@ func (s *stepRemoteUpload) Run(state multistep.StateBag) multistep.StepAction {
return
multistep
.
ActionContinue
return
multistep
.
ActionContinue
}
}
config
:=
state
.
Get
(
"config"
)
.
(
*
config
)
checksum
:=
config
.
ISOChecksum
checksumType
:=
config
.
ISOChecksumType
ui
.
Say
(
s
.
Message
)
ui
.
Say
(
s
.
Message
)
log
.
Printf
(
"Remote uploading: %s"
,
path
)
log
.
Printf
(
"Remote uploading: %s"
,
path
)
newPath
,
err
:=
remote
.
UploadISO
(
path
)
newPath
,
err
:=
remote
.
UploadISO
(
path
,
checksum
,
checksumType
)
if
err
!=
nil
{
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error uploading file: %s"
,
err
)
err
:=
fmt
.
Errorf
(
"Error uploading file: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
state
.
Put
(
"error"
,
err
)
...
...
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