Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/781#discussion_r130329597
  
    --- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/templates/customize/TemplateOptionsOption.java
 ---
    @@ -39,8 +49,22 @@ public void apply(TemplateOptions options, ConfigBag 
config, Object v) {
     
             Class<? extends TemplateOptions> clazz = options.getClass();
             for (final Map.Entry<String, Object> option : 
optionsMap.entrySet()) {
    -            if (option.getValue() != null) {
    -                Maybe<?> result = 
MethodCoercions.tryFindAndInvokeBestMatchingMethod(options, option.getKey(), 
option.getValue());
    +            Object optionValue = option.getValue();
    +            if (optionValue != null) {
    +
    +                try {
    +                    final EntityInternal entity = (EntityInternal) 
BrooklynTaskTags.getTargetOrContextEntity(Tasks.current());
    +                    final ExecutionContext exec = (null != entity
    +                        ? entity.getExecutionContext()
    +                        : 
BasicExecutionContext.getCurrentExecutionContext());
    +                    if (exec != null) {
    --- End diff --
    
    I wonder if there is some way we could log.warn if `exec != null` and if 
the value is a deferred supplier. But not sure how easy it is to do for the 
latter (looking at `ValueResolver`, it handles `v instanceof ImmediateSupplier 
|| v instanceof DeferredSupplier || v instanceof TaskFactory || v instanceof 
TaskAdaptable || v instanceof Task || v instanceof Future`, but it also 
recursively looks inside iterables and maps.
    
    Therefore maybe just ignore this comment :-(


---
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.
---

Reply via email to