Merge pull request #284 from coolljt0725/set_default_shim
set default shim if shim is nil for backward compatibility
This commit is contained in:
		| @@ -143,7 +143,7 @@ func New(opts ContainerOpts) (Container, error) { | |||||||
| } | } | ||||||
|  |  | ||||||
| // Load return a new container from the matchin state file on disk. | // Load return a new container from the matchin state file on disk. | ||||||
| func Load(root, id string, timeout time.Duration) (Container, error) { | func Load(root, id, shimName string, timeout time.Duration) (Container, error) { | ||||||
| 	var s state | 	var s state | ||||||
| 	f, err := os.Open(filepath.Join(root, id, StateFile)) | 	f, err := os.Open(filepath.Join(root, id, StateFile)) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @@ -165,6 +165,11 @@ func Load(root, id string, timeout time.Duration) (Container, error) { | |||||||
| 		processes:   make(map[string]*process), | 		processes:   make(map[string]*process), | ||||||
| 		timeout:     timeout, | 		timeout:     timeout, | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if c.shim == "" { | ||||||
|  | 		c.shim = shimName | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	dirs, err := ioutil.ReadDir(filepath.Join(root, id)) | 	dirs, err := ioutil.ReadDir(filepath.Join(root, id)) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
|   | |||||||
| @@ -307,7 +307,7 @@ func (s *Supervisor) restore() error { | |||||||
| 			continue | 			continue | ||||||
| 		} | 		} | ||||||
| 		id := d.Name() | 		id := d.Name() | ||||||
| 		container, err := runtime.Load(s.stateDir, id, s.timeout) | 		container, err := runtime.Load(s.stateDir, id, s.shim, s.timeout) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kenfe-Mickaël Laventure
					Kenfe-Mickaël Laventure