forked from crc-org/crc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
14 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -879,7 +879,11 @@ func EnsureUserIsLoggedIntoClusterSucceedsOrFails(expected string) error { | |
} | ||
|
||
func EnsureOCCommandIsAvailable() error { | ||
return setOcEnv() | ||
err := setOcEnv() | ||
if err != nil { | ||
return err | ||
} | ||
return setPodmanEnv() | ||
} | ||
|
||
func setOcEnv() error { | ||
|
@@ -889,6 +893,13 @@ func setOcEnv() error { | |
return util.ExecuteCommandSucceedsOrFails("eval $(crc oc-env)", "succeeds") | ||
} | ||
|
||
func setPodmanEnv() error { | ||
if runtime.GOOS == "windows" { | ||
return util.ExecuteCommandSucceedsOrFails("crc podman-env | Invoke-Expression", "succeeds") | ||
} | ||
return util.ExecuteCommandSucceedsOrFails("eval $(crc podman-env)", "succeeds") | ||
} | ||
|
||
func SetConfigPropertyToValueSucceedsOrFails(property string, value string, expected string) error { | ||
// Since network-mode is only supported on Linux, we skip this property test for non-linux platforms | ||
if property == "network-mode" && runtime.GOOS != "linux" { | ||
|
@@ -937,13 +948,13 @@ func DeletingPodSucceedsOrFails(expected string) error { | |
func PodmanCommandIsAvailable() error { | ||
|
||
// Do what 'eval $(crc podman-env) would do | ||
path := os.ExpandEnv("${HOME}/.crc/bin/oc:$PATH") | ||
path := os.ExpandEnv("${HOME}/.crc/bin/podman:$PATH") | ||
csshk := os.ExpandEnv("${HOME}/.crc/machines/crc/id_ecdsa") | ||
dh := os.ExpandEnv("unix:///${HOME}/.crc/machines/crc/docker.sock") | ||
ch := "ssh://[email protected]:2222/run/user/1000/podman/podman.sock" | ||
if runtime.GOOS == "windows" { | ||
userHomeDir, _ := os.UserHomeDir() | ||
unexpandedPath := filepath.Join(userHomeDir, ".crc/bin/oc;${PATH}") | ||
unexpandedPath := filepath.Join(userHomeDir, ".crc/bin/podman;${PATH}") | ||
path = os.ExpandEnv(unexpandedPath) | ||
csshk = filepath.Join(userHomeDir, ".crc/machines/crc/id_ecdsa") | ||
dh = "npipe:////./pipe/crc-podman" | ||
|