mirror of https://github.com/docker/cli.git
move secretopt to opts pkg
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
d22e1a91f6
commit
91c08eab93
|
@ -432,7 +432,7 @@ type serviceOptions struct {
|
|||
logDriver logDriverOptions
|
||||
|
||||
healthcheck healthCheckOptions
|
||||
secrets SecretOpt
|
||||
secrets opts.SecretOpt
|
||||
}
|
||||
|
||||
func newServiceOptions() *serviceOptions {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue