terraform: gofmt -w -r 'Context2 -> Context' terraform/

This commit is contained in:
Mitchell Hashimoto 2015-02-13 18:15:36 -08:00
parent e37c187228
commit 7ccba588ac
4 changed files with 18 additions and 18 deletions

View File

@ -44,7 +44,7 @@ type ContextOpts struct {
// Context represents all the context that Terraform needs in order to // Context represents all the context that Terraform needs in order to
// perform operations on infrastructure. This structure is built using // perform operations on infrastructure. This structure is built using
// NewContext. See the documentation for that. // NewContext. See the documentation for that.
type Context2 struct { type Context struct {
diff *Diff diff *Diff
diffLock sync.RWMutex diffLock sync.RWMutex
hooks []Hook hooks []Hook
@ -67,7 +67,7 @@ type Context2 struct {
// Once a Context is creator, the pointer values within ContextOpts // Once a Context is creator, the pointer values within ContextOpts
// should not be mutated in any way, since the pointers are copied, not // should not be mutated in any way, since the pointers are copied, not
// the values themselves. // the values themselves.
func NewContext2(opts *ContextOpts) *Context2 { func NewContext(opts *ContextOpts) *Context {
// Copy all the hooks and add our stop hook. We don't append directly // 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. // to the Config so that we're not modifying that in-place.
sh := new(stopHook) sh := new(stopHook)
@ -81,7 +81,7 @@ func NewContext2(opts *ContextOpts) *Context2 {
state.init() state.init()
} }
return &Context2{ return &Context{
diff: opts.Diff, diff: opts.Diff,
hooks: hooks, hooks: hooks,
module: opts.Module, module: opts.Module,
@ -97,7 +97,7 @@ func NewContext2(opts *ContextOpts) *Context2 {
// GraphBuilder returns the GraphBuilder that will be used to create // GraphBuilder returns the GraphBuilder that will be used to create
// the graphs for this context. // the graphs for this context.
func (c *Context2) GraphBuilder() GraphBuilder { func (c *Context) GraphBuilder() GraphBuilder {
// TODO test // TODO test
providers := make([]string, 0, len(c.providers)) providers := make([]string, 0, len(c.providers))
for k, _ := range c.providers { for k, _ := range c.providers {
@ -121,7 +121,7 @@ func (c *Context2) GraphBuilder() GraphBuilder {
// Input asks for input to fill variables and provider configurations. // Input asks for input to fill variables and provider configurations.
// This modifies the configuration in-place, so asking for Input twice // This modifies the configuration in-place, so asking for Input twice
// may result in different UI output showing different current values. // may result in different UI output showing different current values.
func (c *Context2) Input(mode InputMode) error { func (c *Context) Input(mode InputMode) error {
v := c.acquireRun() v := c.acquireRun()
defer c.releaseRun(v) defer c.releaseRun(v)
@ -202,7 +202,7 @@ func (c *Context2) Input(mode InputMode) error {
// //
// In addition to returning the resulting state, this context is updated // In addition to returning the resulting state, this context is updated
// with the latest state. // with the latest state.
func (c *Context2) Apply() (*State, error) { func (c *Context) Apply() (*State, error) {
v := c.acquireRun() v := c.acquireRun()
defer c.releaseRun(v) defer c.releaseRun(v)
@ -226,7 +226,7 @@ func (c *Context2) Apply() (*State, error) {
// //
// Plan also updates the diff of this context to be the diff generated // Plan also updates the diff of this context to be the diff generated
// by the plan, so Apply can be called after. // by the plan, so Apply can be called after.
func (c *Context2) Plan(opts *PlanOpts) (*Plan, error) { func (c *Context) Plan(opts *PlanOpts) (*Plan, error) {
v := c.acquireRun() v := c.acquireRun()
defer c.releaseRun(v) defer c.releaseRun(v)
@ -278,7 +278,7 @@ func (c *Context2) Plan(opts *PlanOpts) (*Plan, error) {
// //
// Even in the case an error is returned, the state will be returned and // Even in the case an error is returned, the state will be returned and
// will potentially be partially updated. // will potentially be partially updated.
func (c *Context2) Refresh() (*State, []error) { func (c *Context) Refresh() (*State, []error) {
v := c.acquireRun() v := c.acquireRun()
defer c.releaseRun(v) defer c.releaseRun(v)
@ -300,7 +300,7 @@ func (c *Context2) Refresh() (*State, []error) {
// Stop stops the running task. // Stop stops the running task.
// //
// Stop will block until the task completes. // Stop will block until the task completes.
func (c *Context2) Stop() { func (c *Context) Stop() {
c.l.Lock() c.l.Lock()
ch := c.runCh ch := c.runCh
@ -319,7 +319,7 @@ func (c *Context2) Stop() {
} }
// Validate validates the configuration and returns any warnings or errors. // Validate validates the configuration and returns any warnings or errors.
func (c *Context2) Validate() ([]string, []error) { func (c *Context) Validate() ([]string, []error) {
v := c.acquireRun() v := c.acquireRun()
defer c.releaseRun(v) defer c.releaseRun(v)
@ -350,7 +350,7 @@ func (c *Context2) Validate() ([]string, []error) {
return walker.ValidationWarnings, rerrs.Errors return walker.ValidationWarnings, rerrs.Errors
} }
func (c *Context2) acquireRun() chan<- struct{} { func (c *Context) acquireRun() chan<- struct{} {
c.l.Lock() c.l.Lock()
defer c.l.Unlock() defer c.l.Unlock()
@ -367,7 +367,7 @@ func (c *Context2) acquireRun() chan<- struct{} {
return ch return ch
} }
func (c *Context2) releaseRun(ch chan<- struct{}) { func (c *Context) releaseRun(ch chan<- struct{}) {
c.l.Lock() c.l.Lock()
defer c.l.Unlock() defer c.l.Unlock()
@ -376,7 +376,7 @@ func (c *Context2) releaseRun(ch chan<- struct{}) {
c.sh.Reset() c.sh.Reset()
} }
func (c *Context2) walk(operation walkOperation) (*ContextGraphWalker, error) { func (c *Context) walk(operation walkOperation) (*ContextGraphWalker, error) {
// Build the graph // Build the graph
graph, err := c.GraphBuilder().Build(RootModulePath) graph, err := c.GraphBuilder().Build(RootModulePath)
if err != nil { if err != nil {

View File

@ -4627,8 +4627,8 @@ func TestContext2Apply_singleDestroy(t *testing.T) {
} }
} }
func testContext2(t *testing.T, opts *ContextOpts) *Context2 { func testContext2(t *testing.T, opts *ContextOpts) *Context {
return NewContext2(opts) return NewContext(opts)
} }
func testApplyFn( func testApplyFn(

View File

@ -12,7 +12,7 @@ type ContextGraphWalker struct {
NullGraphWalker NullGraphWalker
// Configurable values // Configurable values
Context *Context2 Context *Context
Operation walkOperation Operation walkOperation
// Outputs, do not set these. Do not read these while the graph // Outputs, do not set these. Do not read these while the graph

View File

@ -42,12 +42,12 @@ type Plan struct {
// //
// The following fields in opts are overridden by the plan: Config, // The following fields in opts are overridden by the plan: Config,
// Diff, State, Variables. // Diff, State, Variables.
func (p *Plan) Context(opts *ContextOpts) *Context2 { func (p *Plan) Context(opts *ContextOpts) *Context {
opts.Diff = p.Diff opts.Diff = p.Diff
opts.Module = p.Module opts.Module = p.Module
opts.State = p.State opts.State = p.State
opts.Variables = p.Vars opts.Variables = p.Vars
return NewContext2(opts) return NewContext(opts)
} }
func (p *Plan) String() string { func (p *Plan) String() string {