mirror of https://github.com/docker/cli.git
Add output for "secrets" and "configs" on stack deploy
When deploying a stack from a compose file, the output did not show that a secret or config was created. This patch adds messages for these. Create a configuration file and compose file: $ cat > config.yml <<EOF hello: world EOF $ cat > secret.txt <<EOF p@ssw0rd EOF $ cat > docker-compose.yml <<EOF version: "3.3" services: test: image: nginx:alpine configs: - source: myconfig target: /my-config.yml secrets: - source: mysecret target: /my-secret.txt configs: myconfig: file: ./config.yml secrets: mysecret: file: ./secret.txt EOF Before this patch is applied: $ docker stack deploy -c docker-compose.yml example Creating network example_default Creating service example_test After this patch is applied: $ docker stack deploy -c docker-compose.yml example Creating network example_default Creating secret example_mysecret Creating config example_myconfig Creating service example_test Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
448d56a491
commit
a5113f4368
|
@ -224,6 +224,7 @@ func createSecrets(
|
|||
}
|
||||
case apiclient.IsErrSecretNotFound(err):
|
||||
// secret does not exist, then we create a new one.
|
||||
fmt.Fprintf(dockerCli.Out(), "Creating secret %s\n", secretSpec.Name)
|
||||
if _, err := client.SecretCreate(ctx, secretSpec); err != nil {
|
||||
return errors.Wrapf(err, "failed to create secret %s", secretSpec.Name)
|
||||
}
|
||||
|
@ -251,6 +252,7 @@ func createConfigs(
|
|||
}
|
||||
case apiclient.IsErrConfigNotFound(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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue