Skip to content

Commit c106f00

Browse files
committed
refactor: fix PR comments
1 parent c5c3c09 commit c106f00

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

codefresh/resource_pipeline.go

+11-15
Original file line numberDiff line numberDiff line change
@@ -1117,23 +1117,19 @@ func mapResourceToPipeline(d *schema.ResourceData) (*cfclient.Pipeline, error) {
11171117
},
11181118
}
11191119

1120-
hasPermitRestartChanged := d.HasChange("spec.0.permit_restart_from_failed_steps")
1121-
hasPermitRestartUseAccountChanged := d.HasChange("spec.0.permit_restart_from_failed_steps_use_account_settings")
1122-
if hasPermitRestartChanged || hasPermitRestartUseAccountChanged {
1123-
shouldPermitRestart := d.Get("spec.0.permit_restart_from_failed_steps").(bool)
1124-
shouldUseAccountSettings := d.Get("spec.0.permit_restart_from_failed_steps_use_account_settings").(bool)
1125-
switch shouldUseAccountSettings {
1120+
shouldPermitRestart := d.Get("spec.0.permit_restart_from_failed_steps").(bool)
1121+
shouldUseAccountSettings := d.Get("spec.0.permit_restart_from_failed_steps_use_account_settings").(bool)
1122+
switch shouldUseAccountSettings {
1123+
case true:
1124+
pipeline.Spec.PermitRestartFromFailedSteps = nil
1125+
default:
1126+
switch shouldPermitRestart {
11261127
case true:
1127-
pipeline.Spec.PermitRestartFromFailedSteps = nil
1128+
pipeline.Spec.PermitRestartFromFailedSteps = ptrBool(true)
1129+
case false:
1130+
pipeline.Spec.PermitRestartFromFailedSteps = ptrBool(false)
11281131
default:
1129-
switch shouldPermitRestart {
1130-
case true:
1131-
pipeline.Spec.PermitRestartFromFailedSteps = ptrBool(true)
1132-
case false:
1133-
pipeline.Spec.PermitRestartFromFailedSteps = ptrBool(false)
1134-
default:
1135-
pipeline.Spec.PermitRestartFromFailedSteps = nil
1136-
}
1132+
pipeline.Spec.PermitRestartFromFailedSteps = nil
11371133
}
11381134
}
11391135

0 commit comments

Comments
 (0)