mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(ecs): look up a task definition without failing on a stored record with no ARN (#5296)
* fix(ecs): look up a task definition without failing on a stored record with no ARN resolveTaskDefinitionOrThrow compared each stored definition's ARN with d.getTaskDefinitionArn().equals(ref), so a family or family:revision lookup threw a NullPointerException when the region held a definition with no ARN. The comparison is now null-safe, and EcsTaskDefinitionLegacyKeyTest covers a family lookup next to such a record. * fix(ecs): answer a missing task definition reference with ClientException A null or blank reference reached the lookup's comparisons and threw a NullPointerException, a 500, once the region held any task definition: the family fallback's family.equals(...) failed even before the null-safe ARN comparison. It is now refused up front with the same ClientException an unknown reference gets. * test(ecs): cover the family lookup in the existing no-ARN test
This commit is contained in:
1 parent
d39c7e1381
commit
4927f71ce1
2 files changed
+20
-1
No files matched your search
@@ -5265,10 +5265,13 @@ public class EcsService implements ContainerTeardown, ResourceProvider, Resettab
|
||||
}
|
||||
|
||||
private TaskDefinition resolveTaskDefinitionOrThrow(String ref, String region) {
|
||||
if (ref == null || ref.isBlank()) {
|
||||
throw new AwsException("ClientException", "Unable to describe task definition: " + ref, 400);
|
||||
}
|
||||
TaskDefinition td = taskDefinitions.get(familyKey(region, ref));
|
||||
if (td != null) { return td; }
|
||||
td = taskDefinitionsIn(region)
|
||||
.filter(d -> d.getTaskDefinitionArn().equals(ref)
|
||||
.filter(d -> ref.equals(d.getTaskDefinitionArn())
|
||||
|| (d.getFamily() + ":" + d.getRevision()).equals(ref))
|
||||
.findFirst().orElse(null);
|
||||
if (td != null) { return td; }
|
||||
|
||||
Reference in new issue
Block a user