@@ -542,18 +542,8 @@ func (h *handler) Update(ctx context.Context, mg *unstructured.Unstructured) err
542542 message : "Composition values updated" ,
543543 chartURL : pkg .URL ,
544544 chartVersion : pkg .Version ,
545+ conditionType : ConditionTypeAvailable ,
545546 }
546-
547- if compositionMeta .IsGracefullyPaused (mg ) {
548- statusOpts .conditionType = ConditionTypeReconcileGracefullyPaused
549- compositionMeta .SetGracefullyPausedTime (mg , time .Now ())
550- log .Debug ("Composition gracefully paused." )
551- h .eventRecorder .Event (mg , event .Normal (reasonReconciliationGracefullyPaused , "Update" , "Reconciliation paused via the gracefully paused annotation." ))
552- } else {
553- statusOpts .conditionType = ConditionTypeAvailable
554- meta .RemoveAnnotations (mg , compositionMeta .AnnotationKeyReconciliationGracefullyPausedTime )
555- }
556-
557547 err = setStatus (mg , statusOpts )
558548 if err != nil {
559549 return fmt .Errorf ("setting status: %w" , err )
@@ -566,7 +556,19 @@ func (h *handler) Update(ctx context.Context, mg *unstructured.Unstructured) err
566556 if err != nil {
567557 return fmt .Errorf ("updating cr status with values: %w" , err )
568558 }
569- _ , err = tools .Update (ctx , mg , updateOpts )
559+
560+ if compositionMeta .IsGracefullyPaused (mg ) {
561+ statusOpts .conditionType = ConditionTypeReconcileGracefullyPaused
562+ compositionMeta .SetGracefullyPausedTime (mg , time .Now ())
563+ log .Debug ("Composition gracefully paused." )
564+ h .eventRecorder .Event (mg , event .Normal (reasonReconciliationGracefullyPaused , "Update" , "Reconciliation paused via the gracefully paused annotation." ))
565+
566+ } else {
567+ statusOpts .conditionType = ConditionTypeAvailable
568+ meta .RemoveAnnotations (mg , compositionMeta .AnnotationKeyReconciliationGracefullyPausedTime )
569+ }
570+
571+ mg , err = tools .Update (ctx , mg , updateOpts )
570572 if err != nil {
571573 return fmt .Errorf ("updating cr with values: %w" , err )
572574 }
0 commit comments