forked from toolshed/abra
		
	fix: better message for redeploying chaos version
See toolshed/abra#668
This commit is contained in:
		| @ -104,7 +104,7 @@ checkout as-is. Recipe commit hashes are also supported as values for | ||||
|  | ||||
| 		toDeployVersion, err = getDeployVersion(args, deployMeta, app) | ||||
| 		if err != nil { | ||||
| 			log.Fatal(i18n.G("get deploy version: %s", err)) | ||||
| 			log.Fatal(err) | ||||
| 		} | ||||
|  | ||||
| 		if !internal.Chaos { | ||||
| @ -362,7 +362,12 @@ func getDeployVersion(cliArgs []string, deployMeta stack.DeployMeta, app appPkg. | ||||
| 	// Check if the recipe has a version in the .env file | ||||
| 	if app.Recipe.EnvVersion != "" && !internal.DeployLatest { | ||||
| 		if strings.HasSuffix(app.Recipe.EnvVersionRaw, "+U") { | ||||
| 			return "", errors.New(i18n.G("version: can not redeploy chaos version %s", app.Recipe.EnvVersionRaw)) | ||||
| 			// NOTE(d1): use double-line 5 spaces ("FATA ") trick to make a more | ||||
| 			// informative error message. it's ugly but that's our logging situation | ||||
| 			// atm | ||||
| 			return "", errors.New(i18n.G(`cannot redeploy previous chaos version (%s), did you mean to use "--chaos"? | ||||
|      to return to a regular release, specify a release tag, commit SHA or use "--latest"`, | ||||
| 				formatter.BoldDirtyDefault(app.Recipe.EnvVersionRaw))) | ||||
| 		} | ||||
| 		log.Debug(i18n.G("version: taking version from .env file: %s", app.Recipe.EnvVersion)) | ||||
| 		return app.Recipe.EnvVersion, nil | ||||
|  | ||||
| @ -49,7 +49,7 @@ func (r Recipe) Ensure(ctx EnsureContext) error { | ||||
| 	if r.EnvVersion != "" && !ctx.IgnoreEnvVersion { | ||||
| 		log.Debug(i18n.G("ensuring env version %s", r.EnvVersion)) | ||||
| 		if strings.Contains(r.EnvVersion, "+U") { | ||||
| 			return errors.New(i18n.G("can not redeploy chaos version (%s) without --chaos", r.EnvVersion)) | ||||
| 			return errors.New(i18n.G(`cannot redeploy previous chaos version (%s), did you mean to use "--chaos"?`)) | ||||
| 		} | ||||
|  | ||||
| 		if _, err := r.EnsureVersion(r.EnvVersion); err != nil { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user