зеркало из https://github.com/microsoft/docker.git
Remove debug messages
This commit is contained in:
Родитель
e5f8ab6160
Коммит
8d6df3a7e2
|
@ -239,17 +239,14 @@ func (job *Job) DecodeEnv(src io.Reader) error {
|
||||||
// encoding/json decodes integers to float64, but cannot encode them back.
|
// encoding/json decodes integers to float64, but cannot encode them back.
|
||||||
// (See http://golang.org/src/pkg/encoding/json/decode.go#L46)
|
// (See http://golang.org/src/pkg/encoding/json/decode.go#L46)
|
||||||
if fval, ok := v.(float64); ok {
|
if fval, ok := v.(float64); ok {
|
||||||
job.Logf("Converted to float: %v->%v", v, fval)
|
|
||||||
job.SetenvInt(k, int64(fval))
|
job.SetenvInt(k, int64(fval))
|
||||||
} else if sval, ok := v.(string); ok {
|
} else if sval, ok := v.(string); ok {
|
||||||
job.Logf("Converted to string: %v->%v", v, sval)
|
|
||||||
job.Setenv(k, sval)
|
job.Setenv(k, sval)
|
||||||
} else if val, err := json.Marshal(v); err == nil {
|
} else if val, err := json.Marshal(v); err == nil {
|
||||||
job.Setenv(k, string(val))
|
job.Setenv(k, string(val))
|
||||||
} else {
|
} else {
|
||||||
job.Setenv(k, fmt.Sprintf("%v", v))
|
job.Setenv(k, fmt.Sprintf("%v", v))
|
||||||
}
|
}
|
||||||
job.Logf("Decoded %s=%#v to %s=%#v", k, v, k, job.Getenv(k))
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -269,7 +266,6 @@ func (job *Job) EncodeEnv(dst io.Writer) error {
|
||||||
} else {
|
} else {
|
||||||
m[k] = v
|
m[k] = v
|
||||||
}
|
}
|
||||||
job.Logf("Encoded %s=%#v to %s=%#v", k, v, k, m[k])
|
|
||||||
}
|
}
|
||||||
if err := json.NewEncoder(dst).Encode(&m); err != nil {
|
if err := json.NewEncoder(dst).Encode(&m); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -278,24 +274,20 @@ func (job *Job) EncodeEnv(dst io.Writer) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (job *Job) ExportEnv(dst interface{}) (err error) {
|
func (job *Job) ExportEnv(dst interface{}) (err error) {
|
||||||
fmt.Fprintf(os.Stderr, "ExportEnv()\n")
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("ExportEnv %s", err)
|
err = fmt.Errorf("ExportEnv %s", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
job.Logf("ExportEnv: step 1: encode/marshal the env to an intermediary json representation")
|
// step 1: encode/marshal the env to an intermediary json representation
|
||||||
fmt.Fprintf(os.Stderr, "Printed ExportEnv step 1\n")
|
|
||||||
if err := job.EncodeEnv(&buf); err != nil {
|
if err := job.EncodeEnv(&buf); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
job.Logf("ExportEnv: step 1 complete: json=|%s|", buf)
|
// step 2: decode/unmarshal the intermediary json into the destination object
|
||||||
job.Logf("ExportEnv: step 2: decode/unmarshal the intermediary json into the destination object")
|
|
||||||
if err := json.NewDecoder(&buf).Decode(dst); err != nil {
|
if err := json.NewDecoder(&buf).Decode(dst); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
job.Logf("ExportEnv: step 2 complete")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +301,6 @@ func (job *Job) ImportEnv(src interface{}) (err error) {
|
||||||
if err := json.NewEncoder(&buf).Encode(src); err != nil {
|
if err := json.NewEncoder(&buf).Encode(src); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
job.Logf("ImportEnv: json=|%s|", buf)
|
|
||||||
if err := job.DecodeEnv(&buf); err != nil {
|
if err := job.DecodeEnv(&buf); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1332,14 +1332,11 @@ func (srv *Server) RegisterLinks(name string, hostConfig *HostConfig) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (srv *Server) ContainerStart(job *engine.Job) string {
|
func (srv *Server) ContainerStart(job *engine.Job) string {
|
||||||
job.Logf("srv engine = %s", srv.Eng.Root())
|
|
||||||
job.Logf("job engine = %s", job.Eng.Root())
|
|
||||||
if len(job.Args) < 1 {
|
if len(job.Args) < 1 {
|
||||||
return fmt.Sprintf("Usage: %s container_id", job.Name)
|
return fmt.Sprintf("Usage: %s container_id", job.Name)
|
||||||
}
|
}
|
||||||
name := job.Args[0]
|
name := job.Args[0]
|
||||||
runtime := srv.runtime
|
runtime := srv.runtime
|
||||||
job.Logf("loading containers from %s", runtime.repository)
|
|
||||||
container := runtime.Get(name)
|
container := runtime.Get(name)
|
||||||
if container == nil {
|
if container == nil {
|
||||||
return fmt.Sprintf("No such container: %s", name)
|
return fmt.Sprintf("No such container: %s", name)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче