func (agent *ecsAgent) setClusterInConfig(previousCluster string) error {
	// TODO Handle default cluster in a sane and unified way across the codebase
	configuredCluster := agent.cfg.Cluster
	if configuredCluster == "" {
		seelog.Debug("Setting cluster to default; none configured")
		configuredCluster = config.DefaultClusterName
	}
	if previousCluster != configuredCluster {
		err := clusterMismatchError{
			fmt.Errorf(clusterMismatchErrorFormat, previousCluster, configuredCluster),
		}
		seelog.Criticalf("%v", err)
		return err
	}
	agent.cfg.Cluster = previousCluster
	seelog.Infof("Restored cluster '%s'", agent.cfg.Cluster)

	return nil
}
func (agent *ecsAgent) setClusterInConfig(previousCluster string) error {
	
	configuredCluster := agent.cfg.Cluster
	if configuredCluster == "" {
		seelog.Debug("Setting cluster to default; none configured")
		configuredCluster = config.DefaultClusterName
	}
	if previousCluster != configuredCluster {
		err := clusterMismatchError{
			fmt.Errorf(clusterMismatchErrorFormat, previousCluster, configuredCluster),
		}
		seelog.Criticalf("%v", err)
		return err
	}
	agent.cfg.Cluster = previousCluster
	seelog.Infof("Restored cluster '%s'", agent.cfg.Cluster)

	return nil
}
func ( agent * ecsAgent ) setClusterInConfig ( previousCluster string ) error { // TODO Handle default cluster in a sane and unified way across the codebase configuredCluster := agent . cfg . Cluster if configuredCluster == " " { seelog . Debug ( " " ) configuredCluster = config . DefaultClusterName } if previousCluster != configuredCluster { err := clusterMismatchError { fmt . Errorf ( clusterMismatchErrorFormat , previousCluster , configuredCluster ) , } seelog . Criticalf ( " " , err ) return err } agent . cfg . Cluster = previousCluster seelog . Infof ( " " , agent . cfg . Cluster ) return nil }
// setClusterInConfig sets the cluster name in the config object based on
// previous state. It returns an error if there's a mismatch between the
// the current cluster name with what's restored from the cluster state
setClusterInConfig sets the cluster name in the config object based on previous state . It returns an error if there s a mismatch between the the current cluster name with what s restored from the cluster state