Skip to content

Commit e5ae768

Browse files
k8s_status module: fix append issue, when condition was on 0 index (#1837)
when old condition is on index 0, new condition with same type was always appended, instead of replaced.
1 parent 95f2c1d commit e5ae768

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/pkg/scaffold/ansible/k8s_status.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class KubernetesAnsibleStatusModule(KubernetesAnsibleModule):
367367
368368
for condition in new_conditions:
369369
idx = self.get_condition_idx(merged, condition['type'])
370-
if idx:
370+
if idx is not None:
371371
merged[idx] = condition
372372
else:
373373
merged.append(condition)
@@ -378,6 +378,7 @@ class KubernetesAnsibleStatusModule(KubernetesAnsibleModule):
378378
for i, condition in enumerate(conditions):
379379
if condition.get('type') == name:
380380
return i
381+
return None
381382
382383
def object_contains(self, obj, subset):
383384
def dict_is_subset(obj, subset):

0 commit comments

Comments
 (0)