Skip to content

Commit 69d62a3

Browse files
committedNov 10, 2024·
Update LDA references
·
v0.1.0v0.0.4
1 parent d656379 commit 69d62a3

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed
 

‎cmd/cmd.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func newInstallCmd() *cobra.Command {
4646
return installCmd
4747
}
4848

49-
func NewLdaCmd() *cobra.Command {
49+
func NewOdaCmd() *cobra.Command {
5050
odaCmd := &cobra.Command{
5151
Use: "oda",
5252
Short: "Command line manager for ODA project.",
@@ -175,12 +175,12 @@ func setupConfig() {
175175
fmt.Fprintf(config.SysConfig.ErrOut, "Failed to get home directory: %s\n", err)
176176
os.Exit(1)
177177
}
178-
odaDir, err := config.GetLdaDir(homeDir, sudoExecUser)
178+
odaDir, err := config.GetOdaDir(homeDir, sudoExecUser)
179179
if err != nil {
180180
fmt.Fprintf(config.SysConfig.ErrOut, "Failed to get ODA directory: %s\n", err)
181181
os.Exit(1)
182182
}
183-
exePath, err := config.GetLdaBinaryPath()
183+
exePath, err := config.GetOdaBinaryPath()
184184
if err != nil {
185185
fmt.Fprintf(config.SysConfig.ErrOut, "Failed to get executable path: %s\n", err)
186186
os.Exit(1)
@@ -206,7 +206,7 @@ func setupConfig() {
206206
Os: int64(osConf),
207207
OsName: osName,
208208
HomeDir: homeDir,
209-
LdaDir: odaDir,
209+
OdaDir: odaDir,
210210
IsRoot: isRoot,
211211
ExePath: exePath,
212212
User: sudoExecUser,
@@ -218,7 +218,7 @@ func setupConfig() {
218218

219219
// Execute is the entry point for the command line
220220
func Execute() {
221-
odaCmd := NewLdaCmd()
221+
odaCmd := NewOdaCmd()
222222
if err := odaCmd.Execute(); err != nil {
223223
logging.Log.Err(err).Msg("Failed to execute main oda command")
224224
os.Exit(1)
@@ -368,7 +368,7 @@ func install(cmd *cobra.Command, _ []string) error {
368368
ShellLocation: shellLocation,
369369
IsRoot: user.Conf.IsRoot,
370370
SudoExecUser: user.Conf.User,
371-
LdaDir: user.Conf.LdaDir,
371+
OdaDir: user.Conf.OdaDir,
372372
HomeDir: user.Conf.HomeDir,
373373
}
374374

@@ -415,7 +415,7 @@ func uninstall(_ *cobra.Command, _ []string) error {
415415
ShellLocation: shellLocation,
416416
IsRoot: user.Conf.IsRoot,
417417
SudoExecUser: user.Conf.User,
418-
LdaDir: user.Conf.LdaDir,
418+
OdaDir: user.Conf.OdaDir,
419419
HomeDir: user.Conf.HomeDir,
420420
}
421421
shl, err := shell.NewShell(shellConfig, logging.Log)

‎config/os.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ func GetHomeDir(isRoot bool, user *user.User) (string, error) {
9898
return home, nil
9999
}
100100

101-
// GetLdaDir returns the directory for the shell configuration
102-
func GetLdaDir(homeDir string, user *user.User) (string, error) {
101+
// GetOdaDir returns the directory for the shell configuration
102+
func GetOdaDir(homeDir string, user *user.User) (string, error) {
103103
dir := filepath.Join(homeDir, ".oda")
104104
if err := util.CreateDirAndChown(dir, os.ModePerm, user); err != nil {
105105
return "", err
@@ -108,8 +108,8 @@ func GetLdaDir(homeDir string, user *user.User) (string, error) {
108108
return dir, nil
109109
}
110110

111-
// GetLdaBinaryPath returns the path to the oda binary
112-
func GetLdaBinaryPath() (string, error) {
111+
// GetOdaBinaryPath returns the path to the oda binary
112+
func GetOdaBinaryPath() (string, error) {
113113
exePath, err := os.Executable()
114114
if err != nil {
115115
return "", err

‎shell/shell.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ type Config struct {
7070
ShellLocation string
7171
IsRoot bool
7272
SudoExecUser *user.User
73-
LdaDir string
73+
OdaDir string
7474
HomeDir string
7575
}
7676

@@ -92,9 +92,9 @@ func NewShell(config *Config, logger zerolog.Logger) (*Shell, error) {
9292
// InstallShellConfiguration installs the shell configuration
9393
func (s *Shell) InstallShellConfiguration() error {
9494

95-
filePath := filepath.Join(s.Config.LdaDir, shellScriptName[s.Config.ShellType])
95+
filePath := filepath.Join(s.Config.OdaDir, shellScriptName[s.Config.ShellType])
9696

97-
collectorFilePath := filepath.Join(s.Config.LdaDir, CollectorName)
97+
collectorFilePath := filepath.Join(s.Config.OdaDir, CollectorName)
9898

9999
cmdTmpl, err := template.ParseFS(templateFS, CollectorScript)
100100
if err != nil {
@@ -148,14 +148,14 @@ func (s *Shell) InstallShellConfiguration() error {
148148
// DeleteShellConfiguration removes the shell configuration
149149
func (s *Shell) DeleteShellConfiguration() error {
150150

151-
filePath := filepath.Join(s.Config.LdaDir, "oda.sh")
151+
filePath := filepath.Join(s.Config.OdaDir, "oda.sh")
152152

153153
if err := os.Remove(filePath); err != nil {
154154
s.logger.Err(err).Msg("Failed to remove shell configuration")
155155
return err
156156
}
157157

158-
filePath = filepath.Join(s.Config.LdaDir, "collector.sh")
158+
filePath = filepath.Join(s.Config.OdaDir, "collector.sh")
159159
if err := os.Remove(filePath); err != nil {
160160
s.logger.Err(err).Msg("Failed to remove shell configuration")
161161
return err

‎user/user.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ type Config struct {
4747
OsName string `json:"os_name" db:"os_name"`
4848
// HomeDir is the user home directory
4949
HomeDir string `json:"home_dir" db:"home_dir"`
50-
// LdaDir is the home ODA directory where all configurations are stored.
51-
LdaDir string `json:"oda_dir" db:"oda_dir"`
50+
// OdaDir is the home ODA directory where all configurations are stored.
51+
OdaDir string `json:"oda_dir" db:"oda_dir"`
5252
// IsRoot is a value to check if the user is root
5353
IsRoot bool `json:"is_root" db:"is_root"`
5454
// ExePath is the path to the oda binary
@@ -256,8 +256,8 @@ func CompareConfig(existingConf, currentConf *Config) (bool, []string) {
256256
if existingConf.HomeDir != currentConf.HomeDir {
257257
diffs = append(diffs, fmt.Sprintf("Home Directory changed from %s to %s", existingConf.HomeDir, currentConf.HomeDir))
258258
}
259-
if existingConf.LdaDir != currentConf.LdaDir {
260-
diffs = append(diffs, fmt.Sprintf("ODA Directory changed from %s to %s", existingConf.LdaDir, currentConf.LdaDir))
259+
if existingConf.OdaDir != currentConf.OdaDir {
260+
diffs = append(diffs, fmt.Sprintf("ODA Directory changed from %s to %s", existingConf.OdaDir, currentConf.OdaDir))
261261
}
262262
if existingConf.IsRoot != currentConf.IsRoot {
263263
diffs = append(diffs, fmt.Sprintf("IsRoot status changed from %t to %t", existingConf.IsRoot, currentConf.IsRoot))

0 commit comments

Comments
 (0)
Please sign in to comment.