Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 66226030c -> beeb4d8ba


Couchbase SyncGateway should support cluster of ONE node

`IS_IN_CLUSTER` [is ONLY set when a server is explicitly added into a 
cluster](https://github.com/apache/incubator-brooklyn/blob/59208f56a264d85d68ccc51bc9f2acf457dc1107/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java#L461-L462).

The original logic checks for 'IS_IN_CLUSTER'; this means that the sole primary 
node of a single-node cluster will never be eligible to be used with sync 
gateway (even though it actually is...!).

We extend the boolean condition to check for this condition.

Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/72b13293
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/72b13293
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/72b13293

Branch: refs/heads/master
Commit: 72b13293f13d0e39c3c480967ef9b498f20f50e9
Parents: 16d0b88
Author: Hok Shun Poon <[email protected]>
Authored: Wed Dec 24 20:57:29 2014 +0000
Committer: Hok Shun Poon <[email protected]>
Committed: Wed Dec 24 20:57:29 2014 +0000

----------------------------------------------------------------------
 .../nosql/couchbase/CouchbaseSyncGatewaySshDriver.java   | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/72b13293/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
----------------------------------------------------------------------
diff --git 
a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
 
b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
index 3d6104b..19cb2ed 100644
--- 
a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
+++ 
b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
@@ -92,10 +92,10 @@ public class CouchbaseSyncGatewaySshDriver extends 
AbstractSoftwareProcessSshDri
 
                 @Override
                 public boolean apply(@Nullable Entity entity) {
-                    if (entity instanceof CouchbaseNode && 
Boolean.TRUE.equals(entity.getAttribute(CouchbaseNode.IS_IN_CLUSTER))) {
-                        return true;
-                    }
-                    return false;
+                    // Must either be recognised by a cluster as added, or be 
the primary node in a cluster of ONE.
+                    return entity instanceof CouchbaseNode
+                      && 
(Boolean.TRUE.equals(entity.getAttribute(entity.IS_IN_CLUSTER))
+                      || 
Boolean.TRUE.equals(entity.getAttribute(entity.IS_PRIMARY_NODE)));
                 }
             });
             if (cbClusterNode.isPresent()) {
@@ -172,5 +172,4 @@ public class CouchbaseSyncGatewaySshDriver extends 
AbstractSoftwareProcessSshDri
             return arch + fileExtension;
         }
     }
-
-}
\ No newline at end of file
+}

Reply via email to