-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAT-13040][PLAT-12428] YBA Installer improvements
Summary: Updated status command to show all provided hostnames, not just the first. Added a new preflight check that will block upgrades if a service is offline. Fixed issue with generate-config not working with sudo. Test Plan: tested the 3 changes via install + upgrade + status Reviewers: muthu, sanketh Reviewed By: muthu Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D40064
- Loading branch information
Showing
4 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
managed/yba-installer/pkg/preflight/checks/services_running.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package checks | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/yugabyte/yugabyte-db/managed/yba-installer/pkg/common" | ||
"github.com/yugabyte/yugabyte-db/managed/yba-installer/pkg/logging" | ||
) | ||
|
||
var ServicesRunningCheck *servicesRunningCheck = &servicesRunningCheck{ | ||
CheckName: "services_running", | ||
skipAllowed: true, | ||
Services: []common.Component{}, | ||
} | ||
|
||
func SetServicesRunningCheck(services []common.Component) { | ||
logging.Debug("setting services running check: " + fmt.Sprint(services)) | ||
ServicesRunningCheck.Services = services | ||
} | ||
|
||
type servicesRunningCheck struct { | ||
CheckName string | ||
skipAllowed bool | ||
Services []common.Component | ||
} | ||
|
||
func (s *servicesRunningCheck) Name() string { | ||
return s.CheckName | ||
} | ||
|
||
func (s *servicesRunningCheck) SkipAllowed() bool { | ||
return s.skipAllowed | ||
} | ||
|
||
func (s *servicesRunningCheck) Execute() Result { | ||
res := Result{ | ||
Check: s.CheckName, | ||
Status: StatusPassed, | ||
} | ||
|
||
failedServices := make([]string, 0) | ||
for _, service := range s.Services { | ||
status, err := service.Status() | ||
if err != nil { | ||
logging.Error(fmt.Sprintf("Failed to get %s status: %s", service.Name(), err.Error())) | ||
failedServices = append(failedServices, service.Name()) | ||
continue | ||
} | ||
if !common.IsHappyStatus(status) { | ||
logging.Error(fmt.Sprintf("%s has bad status %s", service.Name(), status)) | ||
failedServices = append(failedServices, service.Name()) | ||
} | ||
} | ||
if len(failedServices) > 0 { | ||
res.Error = fmt.Errorf("services '%s' are not running", strings.Join(failedServices, ", ")) | ||
res.Status = StatusCritical | ||
} | ||
|
||
return res | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters