backend/local: don't RefreshState on State API
This commit is contained in:
parent
6e1dc9c77d
commit
ebb22d3ecd
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/hashicorp/errwrap"
|
||||
"github.com/hashicorp/terraform/backend"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform/state"
|
||||
|
@ -113,11 +112,6 @@ func (b *Local) State() (state.State, error) {
|
|||
PathOut: b.StateOutPath,
|
||||
}
|
||||
|
||||
// Load the state as a sanity check
|
||||
if err := s.RefreshState(); err != nil {
|
||||
return nil, errwrap.Wrapf("Error reading local state: {{err}}", err)
|
||||
}
|
||||
|
||||
// If we are backing up the state, wrap it
|
||||
if path := b.StateBackupPath; path != "" {
|
||||
s = &state.BackupState{
|
||||
|
|
|
@ -103,6 +103,9 @@ func TestMetaBackend_emptyWithDefaultState(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("bad: %s", err)
|
||||
}
|
||||
if err := s.RefreshState(); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if actual := s.State().String(); actual != testState().String() {
|
||||
t.Fatalf("bad: %s", actual)
|
||||
}
|
||||
|
@ -173,6 +176,9 @@ func TestMetaBackend_emptyWithExplicitState(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("bad: %s", err)
|
||||
}
|
||||
if err := s.RefreshState(); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if actual := s.State().String(); actual != testState().String() {
|
||||
t.Fatalf("bad: %s", actual)
|
||||
}
|
||||
|
|
|
@ -45,14 +45,14 @@ func (c *StateMvCommand) Run(args []string) int {
|
|||
return cli.RunResultHelp
|
||||
}
|
||||
|
||||
stateFromReal := stateFrom.State()
|
||||
if stateFromReal == nil {
|
||||
c.Ui.Error(fmt.Sprintf(errStateNotFound))
|
||||
if err := stateFrom.RefreshState(); err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
|
||||
return 1
|
||||
}
|
||||
|
||||
if err := stateFrom.RefreshState(); err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Failed to load state: %s", err))
|
||||
stateFromReal := stateFrom.State()
|
||||
if stateFromReal == nil {
|
||||
c.Ui.Error(fmt.Sprintf(errStateNotFound))
|
||||
return 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue