From 66bace35e573622e580b4e6665f368915cd8d8a3 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 21 Feb 2015 12:26:32 -0800 Subject: [PATCH] state: add strings for cache refresh result --- state/cache.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/state/cache.go b/state/cache.go index 375b43e7a..386cc9f59 100644 --- a/state/cache.go +++ b/state/cache.go @@ -1,6 +1,7 @@ package state import ( + "fmt" "reflect" "github.com/hashicorp/terraform/terraform" @@ -189,3 +190,24 @@ const ( // (Push/Pull) CacheRefreshConflict ) + +func (sc CacheRefreshResult) String() string { + switch sc { + case CacheRefreshNoop: + return "Local and remote state in sync" + case CacheRefreshInit: + return "Local state initialized" + case CacheRefreshUpdateLocal: + return "Local state updated" + case CacheRefreshUpdateRemote: + return "Remote state updated" + case CacheRefreshLocalNewer: + return "Local state is newer than remote state, push required" + case CacheRefreshRemoteNewer: + return "Remote state is newer than local state, pull required" + case CacheRefreshConflict: + return "Local and remote state conflict, manual resolution required" + default: + return fmt.Sprintf("Unknown state change type: %d", sc) + } +}