builder/googlecompute: get rid of all client stuff for now
This commit is contained in:
parent
52f51a1dcd
commit
54d59fc79f
|
@ -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
|
||||
}
|
||||
*/
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue