command: extra RefreshState calls

pull/12155/head
Mitchell Hashimoto 9 years ago
parent a49875067d
commit 6e1dc9c77d
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A

@ -38,6 +38,11 @@ func (c *StateListCommand) Run(args []string) int {
return 1
}
if err := state.RefreshState(); err != nil {
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
return 1
}
stateReal := state.State()
if stateReal == nil {
c.Ui.Error(fmt.Sprintf(errStateNotFound))

@ -51,6 +51,11 @@ func (c *StateMvCommand) Run(args []string) int {
return 1
}
if err := stateFrom.RefreshState(); err != nil {
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
return 1
}
// Read the destination state
stateTo := stateFrom
stateToReal := stateFromReal
@ -61,6 +66,11 @@ func (c *StateMvCommand) Run(args []string) int {
return cli.RunResultHelp
}
if err := stateTo.RefreshState(); err != nil {
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
return 1
}
stateToReal = stateTo.State()
if stateToReal == nil {
stateToReal = terraform.NewState()

@ -30,6 +30,10 @@ func (c *StateRmCommand) Run(args []string) int {
c.Ui.Error(fmt.Sprintf(errStateLoadingState, err))
return cli.RunResultHelp
}
if err := state.RefreshState(); err != nil {
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
return 1
}
stateReal := state.State()
if stateReal == nil {

@ -39,6 +39,10 @@ func (c *StateShowCommand) Run(args []string) int {
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
return 1
}
if err := state.RefreshState(); err != nil {
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
return 1
}
stateReal := state.State()
if stateReal == nil {

@ -72,6 +72,10 @@ func (c *TaintCommand) Run(args []string) int {
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
return 1
}
if err := st.RefreshState(); err != nil {
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
return 1
}
if c.Meta.stateLock {
lockInfo := state.NewLockInfo()

@ -60,6 +60,10 @@ func (c *UntaintCommand) Run(args []string) int {
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
return 1
}
if err := st.RefreshState(); err != nil {
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
return 1
}
if c.Meta.stateLock {
lockInfo := state.NewLockInfo()

Loading…
Cancel
Save