From 91c08eab93ac0158842313a1b3a5ec9ca58d493c Mon Sep 17 00:00:00 2001 From: Evan Hazlett Date: Thu, 3 Nov 2016 11:08:22 -0400 Subject: [PATCH] move secretopt to opts pkg Signed-off-by: Evan Hazlett --- command/service/opts.go | 2 +- command/service/parse.go | 18 +++++++++--------- command/service/update.go | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/command/service/opts.go b/command/service/opts.go index 00cdecb67d..45adb37672 100644 --- a/command/service/opts.go +++ b/command/service/opts.go @@ -432,7 +432,7 @@ type serviceOptions struct { logDriver logDriverOptions healthcheck healthCheckOptions - secrets SecretOpt + secrets opts.SecretOpt } func newServiceOptions() *serviceOptions { diff --git a/command/service/parse.go b/command/service/parse.go index 73fa8a0cb9..cbf2745dce 100644 --- a/command/service/parse.go +++ b/command/service/parse.go @@ -12,25 +12,25 @@ import ( // parseSecrets retrieves the secrets from the requested names and converts // them to secret references to use with the spec -func parseSecrets(client client.APIClient, requestedSecrets []*SecretRequestSpec) ([]*swarmtypes.SecretReference, error) { +func parseSecrets(client client.APIClient, requestedSecrets []*types.SecretRequestOptions) ([]*swarmtypes.SecretReference, error) { secretRefs := make(map[string]*swarmtypes.SecretReference) ctx := context.Background() for _, secret := range requestedSecrets { secretRef := &swarmtypes.SecretReference{ - SecretName: secret.source, + SecretName: secret.Source, Target: swarmtypes.SecretReferenceFileTarget{ - Name: secret.target, - UID: secret.uid, - GID: secret.gid, - Mode: secret.mode, + Name: secret.Target, + UID: secret.UID, + GID: secret.GID, + Mode: secret.Mode, }, } - if _, exists := secretRefs[secret.target]; exists { - return nil, fmt.Errorf("duplicate secret target for %s not allowed", secret.source) + if _, exists := secretRefs[secret.Target]; exists { + return nil, fmt.Errorf("duplicate secret target for %s not allowed", secret.Source) } - secretRefs[secret.target] = secretRef + secretRefs[secret.Target] = secretRef } args := filters.NewArgs() diff --git a/command/service/update.go b/command/service/update.go index 37f709e230..1bc72a8f19 100644 --- a/command/service/update.go +++ b/command/service/update.go @@ -413,7 +413,7 @@ func updateEnvironment(flags *pflag.FlagSet, field *[]string) { func getUpdatedSecrets(apiClient client.APIClient, flags *pflag.FlagSet, secrets []*swarm.SecretReference) ([]*swarm.SecretReference, error) { if flags.Changed(flagSecretAdd) { - values := flags.Lookup(flagSecretAdd).Value.(*SecretOpt).Value() + values := flags.Lookup(flagSecretAdd).Value.(*opts.SecretOpt).Value() addSecrets, err := parseSecrets(apiClient, values) if err != nil {