Skip to content

Commit e408d32

Browse files
Merge pull request openshift#7060 from bfournie/pending-action-info
OCPBUGS-4998: Log additional info when status is pending-user-action
2 parents ebabc74 + 21b5a9f commit e408d32

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

pkg/agent/cluster.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,16 @@ func (czero *Cluster) IsBootstrapComplete() (bool, bool, error) {
219219

220220
czero.PrintInstallStatus(clusterMetadata)
221221

222+
// If status indicates pending action, log host info to help pinpoint what is missing
223+
if (*clusterMetadata.Status != czero.installHistory.RestAPIPreviousClusterStatus) &&
224+
(*clusterMetadata.Status == models.ClusterStatusInstallingPendingUserAction) {
225+
for _, host := range clusterMetadata.Hosts {
226+
if *host.Status == models.ClusterStatusInstallingPendingUserAction {
227+
logrus.Debugf("Host %s %s", host.RequestedHostname, *host.StatusInfo)
228+
}
229+
}
230+
}
231+
222232
if *clusterMetadata.Status == models.ClusterStatusReady {
223233
stuck, err := czero.IsClusterStuckInReady()
224234
if err != nil {

pkg/agent/waitfor.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ func WaitForBootstrapComplete(cluster *Cluster) error {
1818
waitContext, cancel := context.WithTimeout(cluster.Ctx, timeout)
1919
defer cancel()
2020

21-
var lastErr error
21+
var lastErrOnExit error
22+
var lastErrStr string
2223
wait.Until(func() {
2324
bootstrap, exitOnErr, err := cluster.IsBootstrapComplete()
2425
if bootstrap && err == nil {
@@ -28,10 +29,14 @@ func WaitForBootstrapComplete(cluster *Cluster) error {
2829

2930
if err != nil {
3031
if exitOnErr {
31-
lastErr = err
32+
lastErrOnExit = err
3233
cancel()
3334
} else {
3435
logrus.Info(err)
36+
if err.Error() != lastErrStr {
37+
logrus.Info(err)
38+
lastErrStr = err.Error()
39+
}
3540
}
3641
}
3742

@@ -47,10 +52,10 @@ func WaitForBootstrapComplete(cluster *Cluster) error {
4752

4853
waitErr := waitContext.Err()
4954
if waitErr != nil {
50-
if waitErr == context.Canceled && lastErr != nil {
51-
return errors.Wrap(lastErr, "bootstrap process returned error")
55+
if errors.Is(waitErr, context.Canceled) && lastErrOnExit != nil {
56+
return errors.Wrap(lastErrOnExit, "bootstrap process returned error")
5257
}
53-
if waitErr == context.DeadlineExceeded {
58+
if errors.Is(waitErr, context.DeadlineExceeded) {
5459
return errors.Wrap(waitErr, "bootstrap process timed out")
5560
}
5661
}

0 commit comments

Comments
 (0)