Re-vendor docker/docker.

Signed-off-by: Ying Li <ying.li@docker.com>
This commit is contained in:
Ying Li 2017-05-16 14:31:19 -07:00
parent 3fe8321d0c
commit 103bfb2739
5 changed files with 37 additions and 7 deletions

View File

@ -6,7 +6,7 @@ github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c
github.com/coreos/etcd 824277cb3a577a0e8c829ca9ec557b973fe06d20 github.com/coreos/etcd 824277cb3a577a0e8c829ca9ec557b973fe06d20
github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76 github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76
github.com/docker/distribution b38e5838b7b2f2ad48e06ec4b500011976080621 github.com/docker/distribution b38e5838b7b2f2ad48e06ec4b500011976080621
github.com/docker/docker 69c35dad8e7ec21de32d42b9dd606d3416ae1566 github.com/docker/docker eb8abc95985bf3882a4a177c409a96e36e25f5b7
github.com/docker/docker-credential-helpers v0.5.0 github.com/docker/docker-credential-helpers v0.5.0
github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06 github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06
github.com/docker/go-connections e15c02316c12de00874640cd76311849de2aeed5 github.com/docker/go-connections e15c02316c12de00874640cd76311849de2aeed5

View File

@ -109,6 +109,16 @@ type CAConfig struct {
// ExternalCAs is a list of CAs to which a manager node will make // ExternalCAs is a list of CAs to which a manager node will make
// certificate signing requests for node certificates. // certificate signing requests for node certificates.
ExternalCAs []*ExternalCA `json:",omitempty"` ExternalCAs []*ExternalCA `json:",omitempty"`
// SigningCACert and SigningCAKey specify the desired signing root CA and
// root CA key for the swarm. When inspecting the cluster, the key will
// be redacted.
SigningCACert string `json:",omitempty"`
SigningCAKey string `json:",omitempty"`
// If this value changes, and there is no specified signing cert and key,
// then the swarm is forced to generate a new root certificate ane key.
ForceRotate uint64 `json:",omitempty"`
} }
// ExternalCAProtocol represents type of external CA. // ExternalCAProtocol represents type of external CA.

View File

@ -36,7 +36,8 @@ type JSONProgress struct {
Total int64 `json:"total,omitempty"` Total int64 `json:"total,omitempty"`
Start int64 `json:"start,omitempty"` Start int64 `json:"start,omitempty"`
// If true, don't show xB/yB // If true, don't show xB/yB
HideCounts bool `json:"hidecounts,omitempty"` HideCounts bool `json:"hidecounts,omitempty"`
Units string `json:"units,omitempty"`
} }
func (p *JSONProgress) String() string { func (p *JSONProgress) String() string {
@ -55,11 +56,16 @@ func (p *JSONProgress) String() string {
if p.Current <= 0 && p.Total <= 0 { if p.Current <= 0 && p.Total <= 0 {
return "" return ""
} }
current := units.HumanSize(float64(p.Current))
if p.Total <= 0 { if p.Total <= 0 {
return fmt.Sprintf("%8v", current) switch p.Units {
case "":
current := units.HumanSize(float64(p.Current))
return fmt.Sprintf("%8v", current)
default:
return fmt.Sprintf("%d %s", p.Current, p.Units)
}
} }
total := units.HumanSize(float64(p.Total))
percentage := int(float64(p.Current)/float64(p.Total)*100) / 2 percentage := int(float64(p.Current)/float64(p.Total)*100) / 2
if percentage > 50 { if percentage > 50 {
percentage = 50 percentage = 50
@ -73,13 +79,25 @@ func (p *JSONProgress) String() string {
pbBox = fmt.Sprintf("[%s>%s] ", strings.Repeat("=", percentage), strings.Repeat(" ", numSpaces)) pbBox = fmt.Sprintf("[%s>%s] ", strings.Repeat("=", percentage), strings.Repeat(" ", numSpaces))
} }
if !p.HideCounts { switch {
case p.HideCounts:
case p.Units == "": // no units, use bytes
current := units.HumanSize(float64(p.Current))
total := units.HumanSize(float64(p.Total))
numbersBox = fmt.Sprintf("%8v/%v", current, total) numbersBox = fmt.Sprintf("%8v/%v", current, total)
if p.Current > p.Total { if p.Current > p.Total {
// remove total display if the reported current is wonky. // remove total display if the reported current is wonky.
numbersBox = fmt.Sprintf("%8v", current) numbersBox = fmt.Sprintf("%8v", current)
} }
default:
numbersBox = fmt.Sprintf("%d/%d %s", p.Current, p.Total, p.Units)
if p.Current > p.Total {
// remove total display if the reported current is wonky.
numbersBox = fmt.Sprintf("%d %s", p.Current, p.Units)
}
} }
if p.Current > 0 && p.Start > 0 && percentage < 50 { if p.Current > 0 && p.Start > 0 && percentage < 50 {

View File

@ -18,6 +18,8 @@ type Progress struct {
// If true, don't show xB/yB // If true, don't show xB/yB
HideCounts bool HideCounts bool
// If not empty, use units instead of bytes for counts
Units string
// Aux contains extra information not presented to the user, such as // Aux contains extra information not presented to the user, such as
// digests for push signing. // digests for push signing.

View File

@ -117,7 +117,7 @@ func (out *progressOutput) WriteProgress(prog progress.Progress) error {
if prog.Message != "" { if prog.Message != "" {
formatted = out.sf.formatStatus(prog.ID, prog.Message) formatted = out.sf.formatStatus(prog.ID, prog.Message)
} else { } else {
jsonProgress := jsonmessage.JSONProgress{Current: prog.Current, Total: prog.Total, HideCounts: prog.HideCounts} jsonProgress := jsonmessage.JSONProgress{Current: prog.Current, Total: prog.Total, HideCounts: prog.HideCounts, Units: prog.Units}
formatted = out.sf.formatProgress(prog.ID, prog.Action, &jsonProgress, prog.Aux) formatted = out.sf.formatProgress(prog.ID, prog.Action, &jsonProgress, prog.Aux)
} }
_, err := out.out.Write(formatted) _, err := out.out.Write(formatted)