Skip to content

Commit

Permalink
Ensure reg.sock exists while the registrar is running
Browse files Browse the repository at this point in the history
Signed-off-by: zhuc <[email protected]>
  • Loading branch information
zhucan authored and zhuc committed Dec 16, 2019
1 parent 0bb1ff3 commit 54d0404
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmd/csi-node-driver-registrar/node_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,17 @@ func nodeRegister(
os.Exit(1)
}
}
if err != nil && !os.IsNotExist(err) {
klog.Errorf("failed to stat the socket %s with error: %+v", socketPath, err)
os.Exit(1)

if err != nil {
if !os.IsNotExist(err) {
klog.Errorf("failed to stat the socket %s with error: %+v", socketPath, err)
os.Exit(1)
} else {
if _, err := os.Create(socketPath); err != nil {
klog.Errorf("failed to create the socket %s with error: %+v", socketPath, err)
os.Exit(1)
}
}
}

var oldmask int
Expand Down

0 comments on commit 54d0404

Please sign in to comment.