Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

mlaventure
Copy link
Contributor

This fixes an issue preventing containerd from starting if the state
directory didn't exist already.

Signed-off-by: Kenfe-Mickael Laventure mickael.laventure@gmail.com

--

diff --git a/containerd/main.go b/containerd/main.go
index 68bdd8e..c9f5bd3 100644
--- a/containerd/main.go
+++ b/containerd/main.go
@@ -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
@@ -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"),
diff --git a/supervisor/supervisor.go b/supervisor/supervisor.go
index e1fd5d6..a6700b1 100644
--- a/supervisor/supervisor.go
+++ b/supervisor/supervisor.go
@@ -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

This fixes an issue preventing containerd from starting if the state
directory didn't exist already.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
@thaJeztah
Copy link
Member

does it need a mention in the changelog as well?

@mlaventure
Copy link
Contributor Author

@thaJeztah The issue isn't in 17.03.0, it was added by the previous vendoring of containerd

@vieux
Copy link
Contributor

vieux commented Mar 15, 2017

LGTM

1 similar comment
@tonistiigi
Copy link
Member

LGTM

@vieux vieux merged commit 3476dbf into moby:17.03.x Mar 15, 2017
@mlaventure mlaventure deleted the update-containerd-17.03 branch March 16, 2017 15:14
@thaJeztah
Copy link
Member

Follow up to #31662

runcom added a commit to projectatomic/containerd that referenced this pull request Jan 19, 2018
moby/moby#31662
moby/moby#31852

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
runcom added a commit to projectatomic/containerd that referenced this pull request Jan 19, 2018
moby/moby#31662
moby/moby#31852

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
runcom added a commit to projectatomic/containerd that referenced this pull request Jan 19, 2018
moby/moby#31662
moby/moby#31852

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.