Skip to content

Commit

Permalink
Update conditions behavior after error (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
OchiengEd committed Oct 13, 2023
2 parents 06cc99c + b2735c8 commit cbc2d46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
5 changes: 0 additions & 5 deletions internal/ansible/controller/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,6 @@ func (r *AnsibleOperatorReconciler) markRunning(ctx context.Context, nn types.Na
crStatus := getStatus(u)

// If there is no current status add that we are working on this resource.
errCond := ansiblestatus.GetCondition(crStatus, ansiblestatus.FailureConditionType)
if errCond != nil {
errCond.Status = v1.ConditionFalse
ansiblestatus.SetCondition(&crStatus, *errCond)
}
successCond := ansiblestatus.GetCondition(crStatus, ansiblestatus.SuccessfulConditionType)
if successCond != nil {
successCond.Status = v1.ConditionFalse
Expand Down
20 changes: 10 additions & 10 deletions internal/ansible/controller/status/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestGetCondition(t *testing.T) {
condType: RunningConditionType,
status: Status{
Conditions: []Condition{
Condition{
{
Type: RunningConditionType,
},
},
Expand All @@ -110,7 +110,7 @@ func TestGetCondition(t *testing.T) {
condType: RunningConditionType,
status: Status{
Conditions: []Condition{
Condition{
{
Type: FailureConditionType,
},
},
Expand All @@ -122,7 +122,7 @@ func TestGetCondition(t *testing.T) {
condType: FailureConditionType,
status: Status{
Conditions: []Condition{
Condition{
{
Type: FailureConditionType,
},
},
Expand All @@ -136,7 +136,7 @@ func TestGetCondition(t *testing.T) {
condType: FailureConditionType,
status: Status{
Conditions: []Condition{
Condition{
{
Type: RunningConditionType,
},
},
Expand Down Expand Up @@ -167,7 +167,7 @@ func TestRemoveCondition(t *testing.T) {
condType: RunningConditionType,
status: Status{
Conditions: []Condition{
Condition{
{
Type: RunningConditionType,
},
},
Expand All @@ -179,7 +179,7 @@ func TestRemoveCondition(t *testing.T) {
condType: RunningConditionType,
status: Status{
Conditions: []Condition{
Condition{
{
Type: FailureConditionType,
},
},
Expand All @@ -191,7 +191,7 @@ func TestRemoveCondition(t *testing.T) {
condType: FailureConditionType,
status: Status{
Conditions: []Condition{
Condition{
{
Type: FailureConditionType,
},
},
Expand All @@ -203,7 +203,7 @@ func TestRemoveCondition(t *testing.T) {
condType: FailureConditionType,
status: Status{
Conditions: []Condition{
Condition{
{
Type: RunningConditionType,
},
},
Expand Down Expand Up @@ -247,7 +247,7 @@ func TestSetCondition(t *testing.T) {
name: "update running condition",
status: &Status{
Conditions: []Condition{
Condition{
{
Type: RunningConditionType,
Status: v1.ConditionTrue,
Reason: SuccessfulReason,
Expand All @@ -264,7 +264,7 @@ func TestSetCondition(t *testing.T) {
name: "do not update running condition",
status: &Status{
Conditions: []Condition{
Condition{
{
Type: RunningConditionType,
Status: v1.ConditionTrue,
Reason: RunningReason,
Expand Down

0 comments on commit cbc2d46

Please sign in to comment.