Skip to content

Commit

Permalink
skupper init improve help text
Browse files Browse the repository at this point in the history
Improve help text in skupper init if podman endpoint is not available.

Fixes #1471
  • Loading branch information
Karen-Schoener committed May 16, 2024
1 parent c04a4b9 commit f40a0ec
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/skupper/skupper_podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ func (s *SkupperPodman) Network() SkupperNetworkClient {
return s.network
}

func getCmdEnablePodmanSocket() string {
if os.Getuid() == 0 {
return "systemctl enable --now podman.socket"
}
return "systemctl --user enable --now podman.socket"
}

func (s *SkupperPodman) NewClient(cmd *cobra.Command, args []string) {
// endpoint can be provided during init
var endpoint string
Expand Down Expand Up @@ -127,21 +134,21 @@ func (s *SkupperPodman) NewClient(cmd *cobra.Command, args []string) {
fmt.Fprintf(out, "Podman endpoint is not available: %s",
utils.DefaultStr(endpoint, clientpodman.GetDefaultPodmanEndpoint()))
fmt.Fprintln(out)
recommendation := `
recommendation := fmt.Sprintf(`
Recommendation:
Make sure you have an active podman endpoint available.
On most systems you can execute:
systemctl --user enable --now podman.socket
%s
Alternatively you could also create your own service that runs:
podman system service --time=0 <URI>
You can get concrete examples through:
podman help system service`
podman help system service`, getCmdEnablePodmanSocket())
fmt.Fprintln(out, recommendation)
s.exit(1)
}
Expand Down

0 comments on commit f40a0ec

Please sign in to comment.