resolve PR review
This commit is contained in:
parent
14bdb57ac7
commit
0845fcf78c
@ -207,9 +207,9 @@ recipes.
|
||||
|
||||
postDeployCmds, ok := app.Env["POST_UPGRADE_CMDS"]
|
||||
if ok && !internal.DontWaitConverge {
|
||||
logrus.Debugf("Run the following post-deploy commands: %s", postDeployCmds)
|
||||
logrus.Debugf("run the following post-deploy commands: %s", postDeployCmds)
|
||||
if err := internal.PostCmds(cl, app, postDeployCmds); err != nil {
|
||||
logrus.Fatal(err)
|
||||
logrus.Fatalf("attempting to run post deploy commands, saw: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// RunCmdRemote executes an abra.sh command in the target service
|
||||
func RunCmdRemote(cl *dockerClient.Client, app config.App, abraSh, serviceName, cmdName, cmdArgs string) error {
|
||||
filters := filters.NewArgs()
|
||||
filters.Add("name", fmt.Sprintf("^%s_%s", app.StackName(), serviceName))
|
||||
|
@ -167,15 +167,18 @@ func DeployAction(c *cli.Context) error {
|
||||
|
||||
postDeployCmds, ok := app.Env["POST_DEPLOY_CMDS"]
|
||||
if ok && !DontWaitConverge {
|
||||
logrus.Debugf("Run the following post-deploy commands: %s", postDeployCmds)
|
||||
logrus.Debugf("run the following post-deploy commands: %s", postDeployCmds)
|
||||
if err := PostCmds(cl, app, postDeployCmds); err != nil {
|
||||
logrus.Fatal(err)
|
||||
logrus.Fatalf("attempting to run post deploy commands, saw: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// PostCmds parses a string of commands and executes them inside of the respective services
|
||||
// the commands string must have the following format:
|
||||
// "<service> <command> <arguments>|<service> <command> <arguments>|... "
|
||||
func PostCmds(cl *dockerClient.Client, app config.App, commands string) error {
|
||||
abraSh := path.Join(config.RECIPES_DIR, app.Recipe, "abra.sh")
|
||||
if _, err := os.Stat(abraSh); err != nil {
|
||||
@ -196,7 +199,7 @@ func PostCmds(cl *dockerClient.Client, app config.App, commands string) error {
|
||||
if len(commandParts) > 2 {
|
||||
parsedCmdArgs = fmt.Sprintf("%s ", strings.Join(commandParts[2:], " "))
|
||||
}
|
||||
logrus.Infof("Running post-command '%s %s' in container %s", cmdName, parsedCmdArgs, targetServiceName)
|
||||
logrus.Infof("running post-command '%s %s' in container %s", cmdName, parsedCmdArgs, targetServiceName)
|
||||
|
||||
if err := EnsureCommand(abraSh, app.Recipe, cmdName); err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user