Skip to content

Commit cbc2d46

Browse files
authored
Update conditions behavior after error (#35)
2 parents 06cc99c + b2735c8 commit cbc2d46

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

internal/ansible/controller/reconcile.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,6 @@ func (r *AnsibleOperatorReconciler) markRunning(ctx context.Context, nn types.Na
302302
crStatus := getStatus(u)
303303

304304
// If there is no current status add that we are working on this resource.
305-
errCond := ansiblestatus.GetCondition(crStatus, ansiblestatus.FailureConditionType)
306-
if errCond != nil {
307-
errCond.Status = v1.ConditionFalse
308-
ansiblestatus.SetCondition(&crStatus, *errCond)
309-
}
310305
successCond := ansiblestatus.GetCondition(crStatus, ansiblestatus.SuccessfulConditionType)
311306
if successCond != nil {
312307
successCond.Status = v1.ConditionFalse

internal/ansible/controller/status/utils_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func TestGetCondition(t *testing.T) {
9696
condType: RunningConditionType,
9797
status: Status{
9898
Conditions: []Condition{
99-
Condition{
99+
{
100100
Type: RunningConditionType,
101101
},
102102
},
@@ -110,7 +110,7 @@ func TestGetCondition(t *testing.T) {
110110
condType: RunningConditionType,
111111
status: Status{
112112
Conditions: []Condition{
113-
Condition{
113+
{
114114
Type: FailureConditionType,
115115
},
116116
},
@@ -122,7 +122,7 @@ func TestGetCondition(t *testing.T) {
122122
condType: FailureConditionType,
123123
status: Status{
124124
Conditions: []Condition{
125-
Condition{
125+
{
126126
Type: FailureConditionType,
127127
},
128128
},
@@ -136,7 +136,7 @@ func TestGetCondition(t *testing.T) {
136136
condType: FailureConditionType,
137137
status: Status{
138138
Conditions: []Condition{
139-
Condition{
139+
{
140140
Type: RunningConditionType,
141141
},
142142
},
@@ -167,7 +167,7 @@ func TestRemoveCondition(t *testing.T) {
167167
condType: RunningConditionType,
168168
status: Status{
169169
Conditions: []Condition{
170-
Condition{
170+
{
171171
Type: RunningConditionType,
172172
},
173173
},
@@ -179,7 +179,7 @@ func TestRemoveCondition(t *testing.T) {
179179
condType: RunningConditionType,
180180
status: Status{
181181
Conditions: []Condition{
182-
Condition{
182+
{
183183
Type: FailureConditionType,
184184
},
185185
},
@@ -191,7 +191,7 @@ func TestRemoveCondition(t *testing.T) {
191191
condType: FailureConditionType,
192192
status: Status{
193193
Conditions: []Condition{
194-
Condition{
194+
{
195195
Type: FailureConditionType,
196196
},
197197
},
@@ -203,7 +203,7 @@ func TestRemoveCondition(t *testing.T) {
203203
condType: FailureConditionType,
204204
status: Status{
205205
Conditions: []Condition{
206-
Condition{
206+
{
207207
Type: RunningConditionType,
208208
},
209209
},
@@ -247,7 +247,7 @@ func TestSetCondition(t *testing.T) {
247247
name: "update running condition",
248248
status: &Status{
249249
Conditions: []Condition{
250-
Condition{
250+
{
251251
Type: RunningConditionType,
252252
Status: v1.ConditionTrue,
253253
Reason: SuccessfulReason,
@@ -264,7 +264,7 @@ func TestSetCondition(t *testing.T) {
264264
name: "do not update running condition",
265265
status: &Status{
266266
Conditions: []Condition{
267-
Condition{
267+
{
268268
Type: RunningConditionType,
269269
Status: v1.ConditionTrue,
270270
Reason: RunningReason,

0 commit comments

Comments
 (0)