From 54d59fc79f2510b641de2fe65cb6fdf20185aadf Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 12 Dec 2013 21:41:14 -0800 Subject: [PATCH] builder/googlecompute: get rid of all client stuff for now --- builder/googlecompute/artifact.go | 14 ++++++++------ builder/googlecompute/builder.go | 9 ++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/builder/googlecompute/artifact.go b/builder/googlecompute/artifact.go index 85800af93..a6ed7e25c 100644 --- a/builder/googlecompute/artifact.go +++ b/builder/googlecompute/artifact.go @@ -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 } diff --git a/builder/googlecompute/builder.go b/builder/googlecompute/builder.go index 5696c2a06..749b3cdce 100644 --- a/builder/googlecompute/builder.go +++ b/builder/googlecompute/builder.go @@ -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 }