Skip to content

Commit

Permalink
Merge pull request stolostron#259 from qiujian16/fix-patch-cond
Browse files Browse the repository at this point in the history
Fix bma status when using patch in syncset
  • Loading branch information
openshift-merge-robot authored Oct 22, 2020
2 parents b927183 + be652f4 commit 8a3735a
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions pkg/controllers/inventory/inventory_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,20 +689,35 @@ func (r *ReconcileBareMetalAsset) checkHiveSyncStatus(
Type: inventoryv1alpha1.ConditionAssetSyncCompleted,
Status: metav1.ConditionFalse,
Reason: "SyncSetAppliedFailed",
Message: "Failed to apply SyncSet",
Message: fmt.Sprintf("Failed to apply SyncSet with err %s", syncSetStatus.FailureMessage),
})
return false
}

if patchCount == 1 {
if syncSetStatus.Result == hiveinternalv1alpha1.FailureSyncSetResult {
if strings.Contains(syncSetStatus.FailureMessage, "not found") {
if r.client.Delete(context.TODO(), syncSet) != nil {
klog.Errorf("Failed to delete syncSet %v", instance.Name)
}
if syncSetStatus.Result == hiveinternalv1alpha1.SuccessSyncSetResult {
meta.SetStatusCondition(&instance.Status.Conditions, metav1.Condition{
Type: inventoryv1alpha1.ConditionAssetSyncCompleted,
Status: metav1.ConditionTrue,
Reason: "SyncSetAppliedSuccessful",
Message: "Successfully applied SyncSet",
})
return true
}

meta.SetStatusCondition(&instance.Status.Conditions, metav1.Condition{
Type: inventoryv1alpha1.ConditionAssetSyncCompleted,
Status: metav1.ConditionFalse,
Reason: "SyncSetAppliedFailed",
Message: fmt.Sprintf("Failed to apply SyncSet with err %s", syncSetStatus.FailureMessage),
})

if strings.Contains(syncSetStatus.FailureMessage, "not found") {
if r.client.Delete(context.TODO(), syncSet) != nil {
klog.Errorf("Failed to delete syncSet %v", instance.Name)
}
return false
}
return false
}

err := fmt.Errorf(
Expand Down

0 comments on commit 8a3735a

Please sign in to comment.