From 4ee6771d3adc4d3b2c4aca4ef638fb1cfb5a2b1b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 3 Jul 2014 11:28:04 -0700 Subject: [PATCH] terraform: remove terraform.go --- terraform/context.go | 4 +++ terraform/terraform.go | 78 ------------------------------------------ 2 files changed, 4 insertions(+), 78 deletions(-) delete mode 100644 terraform/terraform.go diff --git a/terraform/context.go b/terraform/context.go index 66f1c0e64..d558e8dfd 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -11,6 +11,10 @@ import ( "github.com/hashicorp/terraform/helper/multierror" ) +// This is a function type used to implement a walker for the resource +// tree internally on the Terraform structure. +type genericWalkFunc func(*Resource) (map[string]string, error) + // Context represents all the context that Terraform needs in order to // perform operations on infrastructure. This structure is built using // ContextOpts and NewContext. See the documentation for those. diff --git a/terraform/terraform.go b/terraform/terraform.go deleted file mode 100644 index 1e91833b3..000000000 --- a/terraform/terraform.go +++ /dev/null @@ -1,78 +0,0 @@ -package terraform - -// Terraform is the primary structure that is used to interact with -// Terraform from code, and can perform operations such as returning -// all resources, a resource tree, a specific resource, etc. -type Terraform struct { - hooks []Hook - providers map[string]ResourceProviderFactory - stopHook *stopHook -} - -// This is a function type used to implement a walker for the resource -// tree internally on the Terraform structure. -type genericWalkFunc func(*Resource) (map[string]string, error) - -// Config is the configuration that must be given to instantiate -// a Terraform structure. -type Config struct { - Hooks []Hook - Providers map[string]ResourceProviderFactory -} - -/* -// New creates a new Terraform structure, initializes resource providers -// for the given configuration, etc. -// -// Semantic checks of the entire configuration structure are done at this -// time, as well as richer checks such as verifying that the resource providers -// can be properly initialized, can be configured, etc. -func New(c *Config) (*Terraform, error) { - sh := new(stopHook) - sh.Lock() - sh.reset() - sh.Unlock() - - // Copy all the hooks and add our stop hook. We don't append directly - // to the Config so that we're not modifying that in-place. - hooks := make([]Hook, len(c.Hooks)+1) - copy(hooks, c.Hooks) - hooks[len(c.Hooks)] = sh - - return &Terraform{ - hooks: hooks, - stopHook: sh, - providers: c.Providers, - }, nil -} - -/* -// Stop stops all running tasks (applies, plans, refreshes). -// -// This will block until all running tasks are stopped. While Stop is -// blocked, any new calls to Apply, Plan, Refresh, etc. will also block. New -// calls, however, will start once this Stop has returned. -func (t *Terraform) Stop() { - log.Printf("[INFO] Terraform stopping tasks") - - t.stopHook.Lock() - defer t.stopHook.Unlock() - - // Setup the stoppedCh - stoppedCh := make(chan struct{}, t.stopHook.count) - t.stopHook.stoppedCh = stoppedCh - - // Close the channel to signal that we're done - close(t.stopHook.ch) - - // Expect the number of count stops... - log.Printf("[DEBUG] Waiting for %d tasks to stop", t.stopHook.count) - for i := 0; i < t.stopHook.count; i++ { - <-stoppedCh - } - log.Printf("[DEBUG] Stopped!") - - // Success, everything stopped, reset everything - t.stopHook.reset() -} -*/