add locking to plan and refresh commands

This commit is contained in:
James Bardin 2017-02-02 18:08:12 -05:00
parent 1078781487
commit dd19cb202d
2 changed files with 4 additions and 0 deletions

View File

@ -31,6 +31,7 @@ func (c *PlanCommand) Run(args []string) int {
&c.Meta.parallelism, "parallelism", DefaultParallelism, "parallelism")
cmdFlags.StringVar(&c.Meta.statePath, "state", "", "path")
cmdFlags.BoolVar(&detailed, "detailed-exitcode", false, "detailed-exitcode")
cmdFlags.BoolVar(&c.Meta.lockState, "state-lock", true, "lock state")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil {
return 1
@ -84,6 +85,7 @@ func (c *PlanCommand) Run(args []string) int {
opReq.PlanRefresh = refresh
opReq.PlanOutPath = outPath
opReq.Type = backend.OperationTypePlan
opReq.LockState = c.Meta.lockState
// Perform the operation
op, err := b.Operation(context.Background(), opReq)

View File

@ -23,6 +23,7 @@ func (c *RefreshCommand) Run(args []string) int {
cmdFlags.IntVar(&c.Meta.parallelism, "parallelism", 0, "parallelism")
cmdFlags.StringVar(&c.Meta.stateOutPath, "state-out", "", "path")
cmdFlags.StringVar(&c.Meta.backupPath, "backup", "", "path")
cmdFlags.BoolVar(&c.Meta.lockState, "state-lock", true, "lock state")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil {
return 1
@ -52,6 +53,7 @@ func (c *RefreshCommand) Run(args []string) int {
opReq := c.Operation()
opReq.Type = backend.OperationTypeRefresh
opReq.Module = mod
opReq.LockState = c.Meta.lockState
// Perform the operation
op, err := b.Operation(context.Background(), opReq)