Skip to content

Commit e14ddac

Browse files
skupper init improve help text
Improve help text in skupper init if podman endpoint is not available. Fixes #1471
1 parent 431d735 commit e14ddac

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
@@ -131,21 +138,21 @@ func (s *SkupperPodman) NewClient(cmd *cobra.Command, args []string) {
131138
fmt.Fprintf(out, "Podman endpoint is not available: %s",
132139
utils.DefaultStr(endpoint, clientpodman.GetDefaultPodmanEndpoint()))
133140
fmt.Fprintln(out)
134-
recommendation = `
141+
recommendation = fmt.Sprintf(`
135142
Recommendation:
136143
137144
Make sure you have an active podman endpoint available.
138145
On most systems you can execute:
139146
140-
systemctl --user enable --now podman.socket
147+
%s
141148
142149
Alternatively you could also create your own service that runs:
143150
144151
podman system service --time=0 <URI>
145152
146153
You can get concrete examples through:
147154
148-
podman help system service`
155+
podman help system service`, getCmdEnablePodmanSocket())
149156
fmt.Fprintln(out, recommendation)
150157
}
151158
s.exit(1)

0 commit comments

Comments
 (0)