terraform: make all actions cancellable in context

This commit is contained in:
Mitchell Hashimoto 2014-07-03 11:28:47 -07:00
parent 4ee6771d3a
commit 2b3855d5e2
1 changed files with 6 additions and 0 deletions

View File

@ -117,6 +117,9 @@ func (c *Context) Apply() (*State, error) {
// Plan also updates the diff of this context to be the diff generated
// by the plan, so Apply can be called after.
func (c *Context) Plan(opts *PlanOpts) (*Plan, error) {
v := c.acquireRun()
defer c.releaseRun(v)
g, err := Graph(&GraphOpts{
Config: c.config,
Providers: c.providers,
@ -146,6 +149,9 @@ func (c *Context) Plan(opts *PlanOpts) (*Plan, error) {
// Even in the case an error is returned, the state will be returned and
// will potentially be partially updated.
func (c *Context) Refresh() (*State, error) {
v := c.acquireRun()
defer c.releaseRun(v)
g, err := Graph(&GraphOpts{
Config: c.config,
Providers: c.providers,