Skip to content

Commit

Permalink
Merge pull request #626 from mlaventure/fix-statedir-missing
Browse files Browse the repository at this point in the history
Ensure state dir is created before starting server
  • Loading branch information
mlaventure committed Mar 15, 2017
2 parents 595e75c + c21faab commit 4ab9917
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 5 additions & 1 deletion containerd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ func main() {
}

func daemon(context *cli.Context) error {
stateDir := context.String("state-dir")
if err := os.MkdirAll(stateDir, 0755); err != nil {
return err
}
s := make(chan os.Signal, 2048)
signal.Notify(s, syscall.SIGTERM, syscall.SIGINT)
// Split the listen string of the form proto://addr
Expand All @@ -171,7 +175,7 @@ func daemon(context *cli.Context) error {
return err
}
sv, err := supervisor.New(
context.String("state-dir"),
stateDir,
context.String("runtime"),
context.String("shim"),
context.StringSlice("runtime-args"),
Expand Down
3 changes: 0 additions & 3 deletions supervisor/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ const (
// New returns an initialized Process supervisor.
func New(stateDir string, runtimeName, shimName string, runtimeArgs []string, timeout time.Duration, retainCount int) (*Supervisor, error) {
startTasks := make(chan *startTask, 10)
if err := os.MkdirAll(stateDir, 0755); err != nil {
return nil, err
}
machine, err := CollectMachineInformation()
if err != nil {
return nil, err
Expand Down

0 comments on commit 4ab9917

Please sign in to comment.