Skip to content

Commit

Permalink
state: cache should use State.Equal to check equality
Browse files Browse the repository at this point in the history
reflect.DeepEqual was returning false, sometimes.
  • Loading branch information
mitchellh committed Apr 7, 2015
1 parent c9fe0c1 commit 1fac7b6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## 0.4.1 (unreleased)

BUG FIXES:

* command/remote-config: remove spurrious error "nil" when initializing
remote state on a new configuration. [GH-1392]

## 0.4.0 (April 2, 2015)

Expand All @@ -13,7 +16,7 @@ BACKWARDS INCOMPATIBILITIES:
* Period-prefixed configuration files are now ignored. This might break
existing Terraform configurations if you had period-prefixed files.
* The `block_device` attribute of `aws_instance` has been removed in favor
of three more specific attributes to specify block device mappings:
of three more specific attributes to specify block device mappings:
`root_block_device`, `ebs_block_device`, and `ephemeral_block_device`.
Configurations using the old attribute will generate a validation error
indicating that they must be updated to use the new fields [GH-1045].
Expand Down
4 changes: 2 additions & 2 deletions command/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ func remoteState(
"Error preparing remote state: {{err}}", err)
}
default:
return nil, errwrap.Wrapf(
"Error initilizing remote state: {{err}}", err)
return nil, fmt.Errorf(
"Unknown refresh result: %s", cache.RefreshResult())
}
}

Expand Down
3 changes: 1 addition & 2 deletions state/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package state

import (
"fmt"
"reflect"

"github.com/hashicorp/terraform/terraform"
)
Expand Down Expand Up @@ -77,7 +76,7 @@ func (s *CacheState) RefreshState() error {
s.refreshResult = CacheRefreshUpdateLocal
case durable.Serial == cached.Serial:
// They're supposedly equal, verify.
if reflect.DeepEqual(cached, durable) {
if cached.Equal(durable) {
// Hashes are the same, everything is great
s.refreshResult = CacheRefreshNoop
break
Expand Down

1 comment on commit 1fac7b6

@mitchellh
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.