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
54d59fc7
Commit
54d59fc7
authored
Dec 12, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/googlecompute: get rid of all client stuff for now
parent
52f51a1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
builder/googlecompute/artifact.go
builder/googlecompute/artifact.go
+8
-6
builder/googlecompute/builder.go
builder/googlecompute/builder.go
+4
-5
No files found.
builder/googlecompute/artifact.go
View file @
54d59fc7
...
...
@@ -8,7 +8,7 @@ import (
// Artifact represents a GCE image as the result of a Packer build.
type
Artifact
struct
{
imageName
string
client
*
GoogleComputeClient
driver
Driver
}
// BuilderId returns the builder Id.
...
...
@@ -19,11 +19,13 @@ func (*Artifact) BuilderId() string {
// Destroy destroys the GCE image represented by the artifact.
func
(
a
*
Artifact
)
Destroy
()
error
{
log
.
Printf
(
"Destroying image: %s"
,
a
.
imageName
)
// Ignore the operation result as we are not waiting until it completes.
_
,
err
:=
a
.
client
.
DeleteImage
(
a
.
imageName
)
if
err
!=
nil
{
return
err
}
/*
// Ignore the operation result as we are not waiting until it completes.
_, err := a.client.DeleteImage(a.imageName)
if err != nil {
return err
}
*/
return
nil
}
...
...
builder/googlecompute/builder.go
View file @
54d59fc7
...
...
@@ -33,17 +33,16 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
// Run executes a googlecompute Packer build and returns a packer.Artifact
// representing a GCE machine image.
func
(
b
*
Builder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
,
cache
packer
.
Cache
)
(
packer
.
Artifact
,
error
)
{
// Initialize the Google Compute Engine API.
client
,
err
:=
New
(
b
.
config
.
ProjectId
,
b
.
config
.
Zone
,
b
.
config
.
clientSecrets
,
b
.
config
.
privateKeyBytes
)
driver
,
err
:=
NewDriverGCE
(
ui
,
b
.
config
.
ProjectId
,
b
.
config
.
clientSecrets
,
b
.
config
.
privateKeyBytes
)
if
err
!=
nil
{
log
.
Println
(
"Failed to create the Google Compute Engine client."
)
return
nil
,
err
}
// Set up the state.
state
:=
new
(
multistep
.
BasicStateBag
)
state
.
Put
(
"config"
,
b
.
config
)
state
.
Put
(
"
client"
,
client
)
state
.
Put
(
"
driver"
,
driver
)
state
.
Put
(
"hook"
,
hook
)
state
.
Put
(
"ui"
,
ui
)
...
...
@@ -88,7 +87,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
artifact
:=
&
Artifact
{
imageName
:
state
.
Get
(
"image_name"
)
.
(
string
),
client
:
client
,
driver
:
driver
,
}
return
artifact
,
nil
}
...
...
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