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

    https://github.com/apache/brooklyn-server/pull/385#discussion_r85510265
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/location/internal/LocationConfigMap.java
 ---
    @@ -53,10 +58,18 @@ public LocationConfigMap(AbstractLocation loc, 
Map<ConfigKey<?>, Object> storage
     
         @Override
         protected ExecutionContext getExecutionContext(BrooklynObject bo) {
    -        if (bo==null) return null;
    -        ManagementContext mgmt = 
((AbstractLocation)bo).getManagementContext();
    -        if (mgmt==null) return null;
    -        return mgmt.getServerExecutionContext();
    +        // Support DSL in location config. DSL expects to be resolved in 
the execution context of an entity.
    +        // Since there's no location-entity relation try to infer it from 
the context of the caller.
    +        Entity contextEntity = 
BrooklynTaskTags.getTargetOrContextEntity(Tasks.current());
    +        if (contextEntity != null) {
    +            return ((EntityInternal)contextEntity).getExecutionContext();
    --- End diff --
    
    @ahgittin Any thoughts on this change? It's retrieving the context entity's 
execution context if there's one, to be used as the location's execution 
context.
    It's actually the same as what we currently do, just cleaning it up a bit.


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