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

    https://github.com/apache/incubator-brooklyn/pull/894#discussion_r39424611
  
    --- Diff: 
software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
 ---
    @@ -54,17 +69,24 @@ protected void doStart(Collection<? extends Location> 
locations) {
             //
             // We should move this code back to `init()` once we have a 
solution for that.
             // We can also remove the call to Entities.manage() once this is 
in init() again.
    -        
    -        MongoDBRouter router = 
addChild(EntitySpec.create(MongoDBRouter.class)
    -                .configure(MongoDBRouter.CONFIG_SERVERS,
    -                        DependentConfiguration.attributeWhenReady(
    -                                
getConfig(CoLocatedMongoDBRouter.SHARDED_DEPLOYMENT), 
    -                                
MongoDBConfigServerCluster.CONFIG_SERVER_ADDRESSES)));
    +
    +        try {
    +            // Do not attempt to read the configuration until after the 
router has been added to the cluster
    +            // as it is at this point that the authentication 
configuration is set
    +            Task<?> clusterTask = 
DependentConfiguration.attributeWhenReady(router, AbstractGroup.FIRST);
    +            Entities.submit(this, clusterTask);
    +            clusterTask.get();
    +        } catch (Exception e) {
    +            Exceptions.propagateIfFatal(e);
    +        }
    +        MongoDBAuthenticationUtils.setAuthenticationConfig(router, this);
    +        router.sensors().set(MongoDBAuthenticationMixins.ROOT_PASSWORD, 
router.config().get(MongoDBAuthenticationMixins.ROOT_PASSWORD));
    +        router.sensors().set(MongoDBAuthenticationMixins.ROOT_USERNAME, 
router.config().get(MongoDBAuthenticationMixins.ROOT_USERNAME));
    +        
router.sensors().set(MongoDBAuthenticationMixins.AUTHENTICATION_DATABASE, 
router.config().get(MongoDBAuthenticationMixins.AUTHENTICATION_DATABASE));
             Entities.manage(router);
    --- End diff --
    
    Appreciate this is unchanged in this pull request. Do you recall why the 
router is only managed here? Shouldn't it happen in `init`?


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