From 1fac7b648844155740052e3990f7639827d841e4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 7 Apr 2015 15:03:04 -0700 Subject: [PATCH] state: cache should use State.Equal to check equality reflect.DeepEqual was returning false, sometimes. --- CHANGELOG.md | 5 ++++- command/state.go | 4 ++-- state/cache.go | 3 +-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 417ae3002..ceac4264c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) @@ -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]. diff --git a/command/state.go b/command/state.go index da34cfb2f..fc33c3d8f 100644 --- a/command/state.go +++ b/command/state.go @@ -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()) } } diff --git a/state/cache.go b/state/cache.go index a20eb4a06..e58e1ee2d 100644 --- a/state/cache.go +++ b/state/cache.go @@ -2,7 +2,6 @@ package state import ( "fmt" - "reflect" "github.com/hashicorp/terraform/terraform" ) @@ -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