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
|
logDriver logDriverOptions
|
||||||
|
|
||||||
healthcheck healthCheckOptions
|
healthcheck healthCheckOptions
|
||||||
secrets SecretOpt
|
secrets opts.SecretOpt
|
||||||
}
|
}
|
||||||
|
|
||||||
func newServiceOptions() *serviceOptions {
|
func newServiceOptions() *serviceOptions {
|
||||||
|
|
|
@ -12,25 +12,25 @@ import (
|
||||||
|
|
||||||
// parseSecrets retrieves the secrets from the requested names and converts
|
// parseSecrets retrieves the secrets from the requested names and converts
|
||||||
// them to secret references to use with the spec
|
// 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)
|
secretRefs := make(map[string]*swarmtypes.SecretReference)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
for _, secret := range requestedSecrets {
|
for _, secret := range requestedSecrets {
|
||||||
secretRef := &swarmtypes.SecretReference{
|
secretRef := &swarmtypes.SecretReference{
|
||||||
SecretName: secret.source,
|
SecretName: secret.Source,
|
||||||
Target: swarmtypes.SecretReferenceFileTarget{
|
Target: swarmtypes.SecretReferenceFileTarget{
|
||||||
Name: secret.target,
|
Name: secret.Target,
|
||||||
UID: secret.uid,
|
UID: secret.UID,
|
||||||
GID: secret.gid,
|
GID: secret.GID,
|
||||||
Mode: secret.mode,
|
Mode: secret.Mode,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, exists := secretRefs[secret.target]; exists {
|
if _, exists := secretRefs[secret.Target]; exists {
|
||||||
return nil, fmt.Errorf("duplicate secret target for %s not allowed", secret.source)
|
return nil, fmt.Errorf("duplicate secret target for %s not allowed", secret.Source)
|
||||||
}
|
}
|
||||||
secretRefs[secret.target] = secretRef
|
secretRefs[secret.Target] = secretRef
|
||||||
}
|
}
|
||||||
|
|
||||||
args := filters.NewArgs()
|
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) {
|
func getUpdatedSecrets(apiClient client.APIClient, flags *pflag.FlagSet, secrets []*swarm.SecretReference) ([]*swarm.SecretReference, error) {
|
||||||
if flags.Changed(flagSecretAdd) {
|
if flags.Changed(flagSecretAdd) {
|
||||||
values := flags.Lookup(flagSecretAdd).Value.(*SecretOpt).Value()
|
values := flags.Lookup(flagSecretAdd).Value.(*opts.SecretOpt).Value()
|
||||||
|
|
||||||
addSecrets, err := parseSecrets(apiClient, values)
|
addSecrets, err := parseSecrets(apiClient, values)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue