Return errors from client in stack deploy configs

Signed-off-by: Paweł Szczekutowicz <pszczekutowicz@gmail.com>
(cherry picked from commit a30dd1b6f3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Paweł Szczekutowicz
2017-12-18 21:20:53 +01:00
committed by Sebastiaan van Stijn
parent c97c6d62c2
commit 6da2ecc95c

View File

@ -248,13 +248,13 @@ func createConfigs(
case err == nil:
// config already exists, then we update that
if err := client.ConfigUpdate(ctx, config.ID, config.Meta.Version, configSpec); err != nil {
errors.Wrapf(err, "failed to update config %s", configSpec.Name)
return errors.Wrapf(err, "failed to update config %s", configSpec.Name)
}
case apiclient.IsErrNotFound(err):
// config does not exist, then we create a new one.
fmt.Fprintf(dockerCli.Out(), "Creating config %s\n", configSpec.Name)
if _, err := client.ConfigCreate(ctx, configSpec); err != nil {
errors.Wrapf(err, "failed to create config %s", configSpec.Name)
return errors.Wrapf(err, "failed to create config %s", configSpec.Name)
}
default:
return err