state: add strings for cache refresh result

This commit is contained in:
Mitchell Hashimoto 2015-02-21 12:26:32 -08:00
parent 6ec1b2b455
commit 66bace35e5
1 changed files with 22 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package state package state
import ( import (
"fmt"
"reflect" "reflect"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
@ -189,3 +190,24 @@ const (
// (Push/Pull) // (Push/Pull)
CacheRefreshConflict 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)
}
}