Skip to content

Commit

Permalink
Move constants.DefaultBundlePath to generic code
Browse files Browse the repository at this point in the history
At the moment it's duplicated 3 times in os specific files, but it's
always set to the same value, so we can move it to the common
constants.go. GetDefaultBundle() is what will differ on the various OS.
  • Loading branch information
cfergeau authored and praveenkumar committed Nov 14, 2019
1 parent 5665330 commit 80d78ec
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 15 deletions.
1 change: 1 addition & 0 deletions pkg/crc/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var (
MachineCacheDir = filepath.Join(MachineBaseDir, "cache")
MachineInstanceDir = filepath.Join(MachineBaseDir, "machines")
GlobalStatePath = filepath.Join(CrcBaseDir, GlobalStateFile)
DefaultBundlePath = filepath.Join(CrcBaseDir, GetDefaultBundle())
bundleEmbedded = "false"
)

Expand Down
5 changes: 0 additions & 5 deletions pkg/crc/constants/constants_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ package constants
import (
"fmt"
"github.com/code-ready/crc/pkg/crc/version"
"path/filepath"
)

const (
OcBinaryName = "oc"
DefaultOcURL = "https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/macosx/oc.tar.gz"
)

var (
DefaultBundlePath = filepath.Join(CrcBaseDir, GetDefaultBundle())
)

func GetDefaultBundle() string {
return fmt.Sprintf("crc_hyperkit_%s.crcbundle", version.GetBundleVersion())
}
5 changes: 0 additions & 5 deletions pkg/crc/constants/constants_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ package constants
import (
"fmt"
"github.com/code-ready/crc/pkg/crc/version"
"path/filepath"
)

const (
OcBinaryName = "oc"
DefaultOcURL = "https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz"
)

var (
DefaultBundlePath = filepath.Join(CrcBaseDir, GetDefaultBundle())
)

func GetDefaultBundle() string {
return fmt.Sprintf("crc_libvirt_%s.crcbundle", version.GetBundleVersion())
}
5 changes: 0 additions & 5 deletions pkg/crc/constants/constants_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ package constants
import (
"fmt"
"github.com/code-ready/crc/pkg/crc/version"
"path/filepath"
)

const (
OcBinaryName = "oc.exe"
DefaultOcURL = "https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/windows/oc.zip"
)

var (
DefaultBundlePath = filepath.Join(CrcBaseDir, GetDefaultBundle())
)

func GetDefaultBundle() string {
// TODO: we will change once we have correct bundle for windows
return fmt.Sprintf("crc_hyperv_%s.crcbundle", version.GetBundleVersion())
Expand Down

0 comments on commit 80d78ec

Please sign in to comment.