brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorbett <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Mongodb authentication
Date Tue, 15 Sep 2015 09:52:42 GMT
Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/894#discussion_r39492512
  
    --- 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 --
    
    I was being slow - it happened here because the router was added here. Suggest moving
the manage call to `init` to be alongside `addChild`.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message