mirror of https://github.com/containers/podman.git
Use url with scheme and path for the unix address
Shortcuts like unix:path and unix:/path do not work everywhere, so make sure to use unix://path when quoting the url (or address) Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
This commit is contained in:
parent
8acd66c115
commit
336055fe3b
2
Makefile
2
Makefile
|
@ -637,7 +637,7 @@ remotesystem:
|
||||||
rc=0;\
|
rc=0;\
|
||||||
if timeout -v 1 true; then \
|
if timeout -v 1 true; then \
|
||||||
SOCK_FILE=$(shell mktemp --dry-run --tmpdir podman_tmp_XXXX);\
|
SOCK_FILE=$(shell mktemp --dry-run --tmpdir podman_tmp_XXXX);\
|
||||||
export PODMAN_SOCKET=unix:$$SOCK_FILE; \
|
export PODMAN_SOCKET=unix://$$SOCK_FILE; \
|
||||||
./bin/podman system service --timeout=0 $$PODMAN_SOCKET > $(if $(PODMAN_SERVER_LOG),$(PODMAN_SERVER_LOG),/dev/null) 2>&1 & \
|
./bin/podman system service --timeout=0 $$PODMAN_SOCKET > $(if $(PODMAN_SERVER_LOG),$(PODMAN_SERVER_LOG),/dev/null) 2>&1 & \
|
||||||
retry=5;\
|
retry=5;\
|
||||||
while [ $$retry -ge 0 ]; do\
|
while [ $$retry -ge 0 ]; do\
|
||||||
|
|
|
@ -12,8 +12,8 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DefaultRootAPIAddress is the default address of the REST socket with unix: prefix
|
// DefaultRootAPIAddress is the default path of the REST socket with unix:// prefix
|
||||||
const DefaultRootAPIAddress = "unix:" + DefaultRootAPIPath
|
const DefaultRootAPIAddress = "unix://" + DefaultRootAPIPath
|
||||||
|
|
||||||
type CliCommand struct {
|
type CliCommand struct {
|
||||||
Command *cobra.Command
|
Command *cobra.Command
|
||||||
|
@ -104,7 +104,7 @@ func DefaultAPIAddress() string {
|
||||||
logrus.Warnf("Failed to get rootless runtime dir for DefaultAPIAddress: %s", err)
|
logrus.Warnf("Failed to get rootless runtime dir for DefaultAPIAddress: %s", err)
|
||||||
return DefaultRootAPIAddress
|
return DefaultRootAPIAddress
|
||||||
}
|
}
|
||||||
return "unix:" + filepath.Join(xdg, "podman", "podman.sock")
|
return "unix://" + filepath.Join(xdg, "podman", "podman.sock")
|
||||||
}
|
}
|
||||||
return DefaultRootAPIAddress
|
return DefaultRootAPIAddress
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ func resolveAPIURI(uri []string) (string, error) {
|
||||||
if err := os.MkdirAll(filepath.Dir(socketPath), 0700); err != nil {
|
if err := os.MkdirAll(filepath.Dir(socketPath), 0700); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return "unix:" + socketPath, nil
|
return "unix://" + socketPath, nil
|
||||||
default:
|
default:
|
||||||
if err := os.MkdirAll(filepath.Dir(registry.DefaultRootAPIPath), 0700); err != nil {
|
if err := os.MkdirAll(filepath.Dir(registry.DefaultRootAPIPath), 0700); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
@ -97,7 +97,7 @@ func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities
|
||||||
return fmt.Errorf("unable to create socket %v: %w", host, err)
|
return fmt.Errorf("unable to create socket %v: %w", host, err)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("API Service endpoint scheme %q is not supported. Try tcp://%s or unix:/%s", uri.Scheme, opts.URI, opts.URI)
|
return fmt.Errorf("API Service endpoint scheme %q is not supported. Try tcp://%s or unix://%s", uri.Scheme, opts.URI, opts.URI)
|
||||||
}
|
}
|
||||||
libpodRuntime.SetRemoteURI(uri.String())
|
libpodRuntime.SetRemoteURI(uri.String())
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,16 +107,16 @@ PODMAN_HOST="${TMPDIR}/podman/podman-socat.sock"
|
||||||
SOCAT_HOST="${TMPDIR}/podman/podman.sock"
|
SOCAT_HOST="${TMPDIR}/podman/podman.sock"
|
||||||
|
|
||||||
cat <<-EOT
|
cat <<-EOT
|
||||||
Podman service running at unix:$SOCAT_HOST
|
Podman service running at unix://$SOCAT_HOST
|
||||||
See /tmp/podman-socat.log for API stream capture
|
See /tmp/podman-socat.log for API stream capture
|
||||||
See /tmp/podman-service.log for service logging
|
See /tmp/podman-service.log for service logging
|
||||||
|
|
||||||
usage: sudo bin/podman-remote --url unix:$SOCAT_HOST images
|
usage: sudo bin/podman-remote --url unix://$SOCAT_HOST images
|
||||||
|
|
||||||
^C to exit
|
^C to exit
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
$PODMAN system service --timeout=0 "unix:$PODMAN_HOST" >/tmp/podman-service.log 2>&1 &
|
$PODMAN system service --timeout=0 "unix://$PODMAN_HOST" >/tmp/podman-service.log 2>&1 &
|
||||||
REAP_PIDS=$!
|
REAP_PIDS=$!
|
||||||
|
|
||||||
socat -v "UNIX-LISTEN:$SOCAT_HOST",fork,reuseaddr,unlink-early "UNIX-CONNECT:$PODMAN_HOST" >/tmp/podman-socat.log 2>&1
|
socat -v "UNIX-LISTEN:$SOCAT_HOST",fork,reuseaddr,unlink-early "UNIX-CONNECT:$PODMAN_HOST" >/tmp/podman-socat.log 2>&1
|
||||||
|
|
|
@ -366,7 +366,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
lockFile.Close()
|
lockFile.Close()
|
||||||
p.RemoteSocketLock = lockPath
|
p.RemoteSocketLock = lockPath
|
||||||
p.RemoteSocket = fmt.Sprintf("unix:%s-%s.sock", pathPrefix, uuid)
|
p.RemoteSocket = fmt.Sprintf("unix://%s-%s.sock", pathPrefix, uuid)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
tries++
|
tries++
|
||||||
|
|
|
@ -18,10 +18,10 @@ function teardown() {
|
||||||
@test "podman system service <bad_scheme_uri> returns error" {
|
@test "podman system service <bad_scheme_uri> returns error" {
|
||||||
skip_if_remote "podman system service unavailable over remote"
|
skip_if_remote "podman system service unavailable over remote"
|
||||||
run_podman 125 system service localhost:9292
|
run_podman 125 system service localhost:9292
|
||||||
is "$output" "Error: API Service endpoint scheme \"localhost\" is not supported. Try tcp://localhost:9292 or unix:/localhost:9292"
|
is "$output" "Error: API Service endpoint scheme \"localhost\" is not supported. Try tcp://localhost:9292 or unix://localhost:9292"
|
||||||
|
|
||||||
run_podman 125 system service myunix.sock
|
run_podman 125 system service myunix.sock
|
||||||
is "$output" "Error: API Service endpoint scheme \"\" is not supported. Try tcp://myunix.sock or unix:/myunix.sock"
|
is "$output" "Error: API Service endpoint scheme \"\" is not supported. Try tcp://myunix.sock or unix://myunix.sock"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "podman-system-service containers survive service stop" {
|
@test "podman-system-service containers survive service stop" {
|
||||||
|
|
Loading…
Reference in New Issue