Skip to content

Commit cfdb66b

Browse files
authored
Merge pull request #5 from brianlaoaws/master-from-brianlao-github-fort
Fix resource targetting for a stack level hook
2 parents a74a040 + e74adc2 commit cfdb66b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/java/software/amazon/cloudformation/HookAbstractWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ protected boolean isHookInvocationPayloadRemote(HookRequestData hookRequestData)
424424
throw new TerminalException("No payload data set.");
425425
}
426426

427-
return hookRequestData.getTargetModel().isEmpty();
427+
return (hookRequestData.getTargetModel() == null || hookRequestData.getTargetModel().isEmpty());
428428
}
429429

430430
/**

src/test/java/software/amazon/cloudformation/HookLambdaWrapperTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,13 @@ public void testIsHookInvocationPayloadRemote() {
418418
HookRequestData onlyPayloadPopulated = HookRequestData.builder()
419419
.targetModel(Collections.emptyMap())
420420
.payload("http://s3PresignedUrl").build();
421+
HookRequestData onlyPayloadPopulatedWithNullTargetModel = HookRequestData.builder().targetModel(null)
422+
.payload("http://s3PresignedUrl").build();
421423

422424
Assertions.assertFalse(wrapper.isHookInvocationPayloadRemote(bothFieldsPopulated));
423425
Assertions.assertFalse(wrapper.isHookInvocationPayloadRemote(onlyTargetModelPopulated));
424426
Assertions.assertTrue(wrapper.isHookInvocationPayloadRemote(onlyPayloadPopulated));
427+
Assertions.assertTrue(wrapper.isHookInvocationPayloadRemote(onlyPayloadPopulatedWithNullTargetModel));
425428
}
426429

427430
private final String expectedStringWhenStrictDeserializingWithExtraneousFields = "Unrecognized field \"targetName\" (class software.amazon.cloudformation.proxy.hook.HookInvocationRequest), not marked as ignorable (10 known properties: \"requestContext\", \"stackId\", \"clientRequestToken\", \"hookModel\", \"hookTypeName\", \"requestData\", \"actionInvocationPoint\", \"awsAccountId\", \"changeSetId\", \"hookTypeVersion\"])\n"

0 commit comments

Comments
 (0)