Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/417#discussion_r87578200
--- Diff:
camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
---
@@ -182,63 +257,112 @@ public Entity call() throws Exception {
throw new IllegalStateException("Unexpected scope
"+scope);
}
- Optional<Entity> result = Iterables.tryFind(entitiesToSearch,
EntityPredicates.configEqualTo(BrooklynCampConstants.PLAN_ID, componentId));
+ String desiredComponentId;
+ if (componentId == null) {
+ if (componentIdSupplier == null) {
+ throw new IllegalArgumentException("No component-id or
component-id supplier, when resolving entity in scope '" + scope + "' wrt " +
entity);
+ }
+
+ Maybe<Object> maybeComponentId =
Tasks.resolving(componentIdSupplier)
+ .as(Object.class)
+ .context(getExecutionContext())
+ .immediately(immediate)
+ .description("Resolving component-id from " +
componentIdSupplier)
+ .getMaybe();
+
+ if (immediate) {
+ if (maybeComponentId.isAbsent()) {
+ return
Maybe.absent(Maybe.getException(maybeComponentId));
+ }
+ }
+
+ // Support being passes an explicit entity via the DSL
--- End diff --
typo `passes`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---