Merge pull request #12167 from rook/mergify/bp/release-1.11/pr-12149

mgr: fix ceph dashboard login issue (backport #12149)
This commit is contained in:
Travis Nielsen authored and GitHub committed 2023-05-02 11:11:18 -06:00
commit 6eaa445a82
3 files changed
+5 -13

No files matched your search

+3 -11
View File
@@ -253,23 +253,15 @@ func ExecuteRBDCommandWithTimeout(context *clusterd.Context, args []string) (str
func ExecuteCephCommandWithRetry(
cmd func() (string, []byte, error),
getExitCode func(err error) (int, bool),
retries int,
retryOnExitCode int,
waitTime time.Duration,
) ([]byte, error) {
for i := 0; i < retries; i++ {
action, data, err := cmd()
if err != nil {
exitCode, parsed := getExitCode(err)
if parsed {
if exitCode == retryOnExitCode {
logger.Infof("command failed for %s. trying again...", action)
time.Sleep(waitTime)
continue
}
}
return nil, errors.Wrapf(err, "failed to complete command for %s", action)
logger.Infof("command failed for %s. trying again...", action)
time.Sleep(waitTime)
continue
}
if i > 0 {
logger.Infof("action %s succeeded on attempt %d", action, i)
+1 -1
View File
@@ -230,7 +230,7 @@ func (c *Cluster) setLoginCredentials(password string) error {
_, err = client.ExecuteCephCommandWithRetry(func() (string, []byte, error) {
output, err := client.NewCephCommand(c.context, c.clusterInfo, args).RunWithTimeout(exec.CephCommandsTimeout)
return "set dashboard creds", output, err
}, c.exitCode, 5, invalidArgErrorCode, dashboardInitWaitTime)
}, 5, dashboardInitWaitTime)
if err != nil {
return errors.Wrap(err, "failed to set login creds on mgr")
}
@@ -50,7 +50,7 @@ func (c *Cluster) setRookOrchestratorBackend() error {
args := []string{"orch", "set", "backend", "rook"}
output, err := client.NewCephCommand(c.context, c.clusterInfo, args).RunWithTimeout(exec.CephCommandsTimeout)
return "set rook backend", output, err
}, c.exitCode, 5, invalidArgErrorCode, orchestratorInitWaitTime)
}, 5, orchestratorInitWaitTime)
if err != nil {
return errors.Wrap(err, "failed to set rook as the orchestrator backend")
}