Fix retryRollout input parameter in order to comply with the API (#1461)

* Fix retryRollout input parameter in order to comply with the API

Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>

* make exception more informative

Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>

---------

Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
This commit is contained in:
Stanislav Trailov
2023-10-24 08:36:46 +03:00
committed by GitHub
parent ecf48430b4
commit 05def2ef1b
2 changed files with 4 additions and 4 deletions

View File

@@ -426,6 +426,6 @@ public interface MgmtRolloutRestApi {
})
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/retry", produces = {
MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE})
ResponseEntity<MgmtRolloutResponseBody> retryRollout(@PathVariable("rolloutId") final String rolloutId);
ResponseEntity<MgmtRolloutResponseBody> retryRollout(@PathVariable("rolloutId") final Long rolloutId);
}

View File

@@ -313,9 +313,9 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
}
@Override
public ResponseEntity<MgmtRolloutResponseBody> retryRollout(final String rolloutId) {
final Rollout rolloutForRetry = this.rolloutManagement.get(Long.parseLong(rolloutId))
.orElseThrow(EntityNotFoundException::new);
public ResponseEntity<MgmtRolloutResponseBody> retryRollout(final Long rolloutId) {
final Rollout rolloutForRetry = this.rolloutManagement.get(rolloutId)
.orElseThrow(() -> new EntityNotFoundException(Rollout.class, rolloutId));
if (rolloutForRetry.isDeleted()) {
throw new EntityNotFoundException(Rollout.class, rolloutId);