Skip to content

Commit 437ea92

Browse files
committed
Use only GetConsoleURL and remove GetProxyConfig
The second method is just a subset of the first one.
1 parent 012d749 commit 437ea92

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

cmd/crc/cmd/oc_env.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ func runOcEnv(args []string) error {
3232
return fmt.Errorf("Error running the oc-env command: %s", err.Error())
3333
}
3434

35-
proxyConfig, err := machine.GetProxyConfig(constants.DefaultName)
35+
consoleResult, err := machine.GetConsoleURL(machine.ConsoleConfig{
36+
Name: constants.DefaultName,
37+
})
3638
if err != nil {
3739
return err
3840
}
41+
proxyConfig := consoleResult.ClusterConfig.ProxyConfig
3942
output.Outln(shell.GetPathEnvString(userShell, constants.CrcOcBinDir))
4043
if proxyConfig.IsEnabled() {
4144
output.Outln(shell.GetEnvString(userShell, "HTTP_PROXY", proxyConfig.HTTPProxy))

pkg/crc/machine/machine.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -689,35 +689,6 @@ func addNameServerToInstance(sshRunner *crcssh.Runner, ns string) error {
689689
return nil
690690
}
691691

692-
// Return proxy config if VM is present
693-
func GetProxyConfig(machineName string) (*network.ProxyConfig, error) {
694-
// Here we are only checking if the VM exist and not the status of the VM.
695-
// We might need to improve and use crc status logic, only
696-
// return if the Openshift is running as part of status.
697-
libMachineAPIClient, cleanup, err := createLibMachineClient(false)
698-
defer cleanup()
699-
if err != nil {
700-
return nil, err
701-
}
702-
host, err := libMachineAPIClient.Load(machineName)
703-
704-
if err != nil {
705-
return nil, errors.New(err.Error())
706-
}
707-
708-
_, crcBundleMetadata, err := getBundleMetadataFromDriver(host.Driver)
709-
if err != nil {
710-
return nil, errors.Newf("Error loading bundle metadata: %v", err)
711-
}
712-
713-
clusterConfig, err := getClusterConfig(crcBundleMetadata)
714-
if err != nil {
715-
return nil, errors.Newf("Error loading cluster configuration: %v", err)
716-
}
717-
718-
return clusterConfig.ProxyConfig, nil
719-
}
720-
721692
// Return console URL if the VM is present.
722693
func GetConsoleURL(consoleConfig ConsoleConfig) (ConsoleResult, error) {
723694
// Here we are only checking if the VM exist and not the status of the VM.

0 commit comments

Comments
 (0)