Merge pull request #28727 from cyli/do-not-display-secret-digest

Do not display the digest or size of swarm secrets [1.13]
This commit is contained in:
Victor Vieux 2016-11-22 16:44:06 -08:00 committed by GitHub
commit 22ba220e86
6 changed files with 13 additions and 30 deletions

View file

@ -2384,11 +2384,6 @@ definitions:
format: "dateTime"
Spec:
$ref: "#/definitions/ServiceSpec"
Digest:
type: "string"
SecretSize:
type: "integer"
format: "int64"
paths:
/containers/json:
get:
@ -7547,8 +7542,6 @@ paths:
UpdatedAt: "2016-11-05T01:20:17.327670065Z"
Spec:
Name: "app-dev.crt"
Digest: "sha256:11d7c6f38253b73e608153c9f662a191ae605e1a3d9b756b0b3426388f91d3fa"
SecretSize: 31
500:
description: "server error"
schema:
@ -7627,8 +7620,6 @@ paths:
UpdatedAt: "2016-11-05T01:20:17.327670065Z"
Spec:
Name: "app-dev.crt"
Digest: "sha256:11d7c6f38253b73e608153c9f662a191ae605e1a3d9b756b0b3426388f91d3fa"
SecretSize: 31
404:
description: "secret not found"
schema:

View file

@ -6,9 +6,7 @@ import "os"
type Secret struct {
ID string
Meta
Spec SecretSpec
Digest string
SecretSize int64
Spec SecretSpec
}
// SecretSpec represents a secret specification from a secret in swarm

View file

@ -50,15 +50,14 @@ func runSecretList(dockerCli *command.DockerCli, opts listOptions) error {
fmt.Fprintf(w, "%s\n", s.ID)
}
} else {
fmt.Fprintf(w, "ID\tNAME\tCREATED\tUPDATED\tSIZE")
fmt.Fprintf(w, "ID\tNAME\tCREATED\tUPDATED")
fmt.Fprintf(w, "\n")
for _, s := range secrets {
created := units.HumanDuration(time.Now().UTC().Sub(s.Meta.CreatedAt)) + " ago"
updated := units.HumanDuration(time.Now().UTC().Sub(s.Meta.UpdatedAt)) + " ago"
size := units.HumanSizeWithPrecision(float64(s.SecretSize), 3)
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", s.ID, s.Spec.Annotations.Name, created, updated, size)
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", s.ID, s.Spec.Annotations.Name, created, updated)
}
}

View file

@ -9,9 +9,7 @@ import (
// SecretFromGRPC converts a grpc Secret to a Secret.
func SecretFromGRPC(s *swarmapi.Secret) swarmtypes.Secret {
secret := swarmtypes.Secret{
ID: s.ID,
Digest: s.Digest,
SecretSize: s.SecretSize,
ID: s.ID,
Spec: swarmtypes.SecretSpec{
Annotations: swarmtypes.Annotations{
Name: s.Spec.Annotations.Name,

View file

@ -45,8 +45,8 @@ For example, given the following secret:
```bash
$ docker secret ls
ID NAME CREATED UPDATED SIZE
mhv17xfe3gh6xc4rij5orpfds secret.json 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC 1679
ID NAME CREATED UPDATED
mhv17xfe3gh6xc4rij5orpfds secret.json 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC
```
```bash
@ -60,11 +60,8 @@ $ docker secret inspect secret.json
"CreatedAt": "2016-10-27T23:25:43.909181089Z",
"UpdatedAt": "2016-10-27T23:25:43.909181089Z",
"Spec": {
"Name": "secret.json",
"Data": null
},
"Digest": "sha256:8281c6d924520986e3c6af23ed8926710a611c90339db582c2a9ac480ba622b7",
"SecretSize": 1679
"Name": "secret.json"
}
}
]
```
@ -72,12 +69,12 @@ $ docker secret inspect secret.json
### Formatting secret output
You can use the --format option to obtain specific information about a
secret. The following example command outputs the digest of the
secret. The following example command outputs the creation time of the
secret.
```bash{% raw %}
$ docker secret inspect --format='{{.Digest}}' mhv17xfe3gh6xc4rij5orpfds
sha256:8281c6d924520986e3c6af23ed8926710a611c90339db582c2a9ac480ba622b7
$ docker secret inspect --format='{{.CreatedAt}}' mhv17xfe3gh6xc4rij5orpfds
2016-10-27 23:25:43.909181089 +0000 UTC
{% endraw %}```

View file

@ -33,8 +33,8 @@ On a manager node:
```bash
$ docker secret ls
ID NAME CREATED UPDATED SIZE
mhv17xfe3gh6xc4rij5orpfds secret.json 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC 1679
ID NAME CREATED UPDATED
mhv17xfe3gh6xc4rij5orpfds secret.json 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC
```
## Related information