Skip to content

Commit 9801914

Browse files
cfergeaupraveenkumar
authored andcommitted
constants: Add AdminHelperPath() function
1 parent 654a79a commit 9801914

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

pkg/crc/adminhelper/hosts.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
package adminhelper
22

33
import (
4-
"path/filepath"
5-
64
"github.com/crc-org/admin-helper/pkg/hosts"
75
"github.com/crc-org/admin-helper/pkg/types"
86
"github.com/crc-org/crc/pkg/crc/constants"
97
)
108

11-
var (
12-
BinPath = filepath.Join(constants.BinDir(), constants.GetAdminHelperExecutable())
13-
)
14-
159
// UpdateHostsFile updates the host's /etc/hosts file with Instance IP.
1610
func UpdateHostsFile(instanceIP string, hostnames ...string) error {
1711
if err := RemoveFromHostsFile(hostnames...); err != nil {

pkg/crc/adminhelper/hosts_unix.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ package adminhelper
55

66
import (
77
"github.com/crc-org/admin-helper/pkg/types"
8+
"github.com/crc-org/crc/pkg/crc/constants"
89
crcos "github.com/crc-org/crc/pkg/os"
910
)
1011

1112
func execute(args ...string) error {
12-
_, _, err := crcos.RunWithDefaultLocale(BinPath, args...)
13+
_, _, err := crcos.RunWithDefaultLocale(constants.AdminHelperPath(), args...)
1314
return err
1415
}
1516

pkg/crc/constants/constants.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ func BinDir() string {
142142
return crcBinDir
143143
}
144144

145+
func AdminHelperPath() string {
146+
return filepath.Join(BinDir(), GetAdminHelperExecutable())
147+
}
148+
145149
// GetHomeDir returns the home directory for the current user
146150
func GetHomeDir() string {
147151
homeDir, err := os.UserHomeDir()

0 commit comments

Comments
 (0)