Skip to content

Commit

Permalink
Create the default root API address path
Browse files Browse the repository at this point in the history
Fixes containers#8184

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Paul Holzinger committed Oct 29, 2020
1 parent fdd3260 commit 12647ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
7 changes: 5 additions & 2 deletions cmd/podman/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import (
"github.com/spf13/cobra"
)

// DefaultRootAPIAddress is the default address of the REST socket
const DefaultRootAPIAddress = "unix:/run/podman/podman.sock"
// DefaultRootAPIPath is the default path of the REST socket
const DefaultRootAPIPath = "/run/podman/podman.sock"

// DefaultRootAPIAddress is the default address of the REST socket with unix: prefix
const DefaultRootAPIAddress = "unix:" + DefaultRootAPIPath

// DefaultVarlinkAddress is the default address of the varlink socket
const DefaultVarlinkAddress = "unix:/run/podman/io.podman"
Expand Down
17 changes: 7 additions & 10 deletions cmd/podman/system/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,17 @@ func resolveAPIURI(_url []string) (string, error) {
if srvArgs.Varlink {
socketName = "io.podman"
}
socketDir := filepath.Join(xdg, "podman", socketName)
if _, err := os.Stat(filepath.Dir(socketDir)); err != nil {
if os.IsNotExist(err) {
if err := os.Mkdir(filepath.Dir(socketDir), 0755); err != nil {
return "", err
}
} else {
return "", err
}
socketPath := filepath.Join(xdg, "podman", socketName)
if err := os.MkdirAll(filepath.Dir(socketPath), 0700); err != nil {
return "", err
}
return "unix:" + socketDir, nil
return "unix:" + socketPath, nil
case srvArgs.Varlink:
return registry.DefaultVarlinkAddress, nil
default:
if err := os.MkdirAll(filepath.Dir(registry.DefaultRootAPIPath), 0700); err != nil {
return "", err
}
return registry.DefaultRootAPIAddress, nil
}
}

0 comments on commit 12647ae

Please sign in to comment.