فهرست منبع

Merge pull request #2591 from dotcloud/fix_Assign_id_as_name_when_all_else_fails

Fix Assign id as name when all else fails
Michael Crosby 11 سال پیش
والد
کامیت
132db329d4
1فایلهای تغییر یافته به همراه2 افزوده شده و 3 حذف شده
  1. 2 3
      runtime.go

+ 2 - 3
runtime.go

@@ -286,13 +286,12 @@ func (runtime *Runtime) restore() error {
 	// Any containers that are left over do not exist in the graph
 	// Any containers that are left over do not exist in the graph
 	for _, container := range containers {
 	for _, container := range containers {
 		// Try to set the default name for a container if it exists prior to links
 		// Try to set the default name for a container if it exists prior to links
-		name, err := generateRandomName(runtime)
+		container.Name, err = generateRandomName(runtime)
 		if err != nil {
 		if err != nil {
 			container.Name = container.ShortID()
 			container.Name = container.ShortID()
 		}
 		}
-		container.Name = name
 
 
-		if _, err := runtime.containerGraph.Set(name, container.ID); err != nil {
+		if _, err := runtime.containerGraph.Set(container.Name, container.ID); err != nil {
 			utils.Debugf("Setting default id - %s", err)
 			utils.Debugf("Setting default id - %s", err)
 		}
 		}
 		register(container)
 		register(container)