Skip to content

Commit

Permalink
[PLAT-15561] Correct path detection for yba-ctl in non-root mode
Browse files Browse the repository at this point in the history
Summary:
yba-ctl was blocking commands that were suppose to be run from the install directory when in non-root mode. This
was not allowing yba-ctl reconfigure to run. We will now correctly detect the $HOME/yba-ctl/yba-ctl path.

Test Plan: verified reconfigure works in non-root mode

Reviewers: muthu, sanketh

Reviewed By: sanketh

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D38597
  • Loading branch information
shubin-yb committed Oct 2, 2024
1 parent bb3153f commit a38d43f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions managed/yba-installer/pkg/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -846,15 +846,15 @@ func GetPostgresConnection(dbname string) (*sql.DB, string, error) {
return db, nonPwdConnStr, nil
}

// RunFromInstalled will return if yba-ctl is an "instanlled" yba-ctl or one locally executed
// RunFromInstalled will return if yba-ctl is an "installed" yba-ctl or one locally executed
func RunFromInstalled() bool {
path, err := os.Executable()
if err != nil {
log.Fatal("unable to determine yba-ctl executable path: " + err.Error())
}

matcher, err := regexp.Compile("(?:/opt/yba-ctl/yba-ctl)|(?:/usr/bin/yba-ctl)|" +
"(?:.*/yugabyte/software/.*/yba_installer/yba-ctl)")
"(?:.*/yugabyte/software/.*/yba_installer/yba-ctl)|(?:.*/yba-ctl/yba-ctl)")

if err != nil {
log.Fatal("could not compile regex: " + err.Error())
Expand Down

0 comments on commit a38d43f

Please sign in to comment.