Skip to content

Commit 5d57ccd

Browse files
skupper init improve help text
Improve help text in skupper init if podman endpoint is not available. Fixes #1471
1 parent c04a4b9 commit 5d57ccd

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cmd/skupper/skupper_podman.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ func (s *SkupperPodman) Network() SkupperNetworkClient {
8989
return s.network
9090
}
9191

92+
func getCmdEnablePodmanSocket() string {
93+
if os.Getuid() == 0 {
94+
return "systemctl enable --now podman.socket"
95+
}
96+
return "systemctl --user enable --now podman.socket"
97+
}
98+
9299
func (s *SkupperPodman) NewClient(cmd *cobra.Command, args []string) {
93100
// endpoint can be provided during init
94101
var endpoint string
@@ -127,21 +134,21 @@ func (s *SkupperPodman) NewClient(cmd *cobra.Command, args []string) {
127134
fmt.Fprintf(out, "Podman endpoint is not available: %s",
128135
utils.DefaultStr(endpoint, clientpodman.GetDefaultPodmanEndpoint()))
129136
fmt.Fprintln(out)
130-
recommendation := `
137+
recommendation := fmt.Sprintf(`
131138
Recommendation:
132139
133140
Make sure you have an active podman endpoint available.
134141
On most systems you can execute:
135142
136-
systemctl --user enable --now podman.socket
143+
%s
137144
138145
Alternatively you could also create your own service that runs:
139146
140147
podman system service --time=0 <URI>
141148
142149
You can get concrete examples through:
143150
144-
podman help system service`
151+
podman help system service`, getCmdEnablePodmanSocket())
145152
fmt.Fprintln(out, recommendation)
146153
s.exit(1)
147154
}

0 commit comments

Comments
 (0)