brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/2] git commit: Updates sensors and curl commands to use localhost instead of getHostname() (required for Docker)
Date Fri, 05 Sep 2014 21:13:19 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 41a68a29a -> bbeaa4b9d


Updates sensors and curl commands to use localhost instead of getHostname() (required for
Docker)


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

Branch: refs/heads/master
Commit: b1581fe802f290a563a1a3e633ded5c8efe4927a
Parents: 954b397
Author: Martin Harris <github@nakomis.com>
Authored: Fri Sep 5 17:03:36 2014 +0100
Committer: Martin Harris <github@nakomis.com>
Committed: Fri Sep 5 17:03:36 2014 +0100

----------------------------------------------------------------------
 .../brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java   | 8 ++++----
 .../entity/nosql/couchbase/CouchbaseNodeSshDriver.java       | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b1581fe8/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java
index 80d563f..37446ce 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java
@@ -84,9 +84,9 @@ public class CouchbaseNodeImpl extends SoftwareProcessImpl implements CouchbaseN
             @Override
             public void onEvent(SensorEvent<Boolean> booleanSensorEvent) {
                 if (Boolean.TRUE.equals(booleanSensorEvent.getValue())) {
-                    String hostname = getAttribute(HOSTNAME);
-                    String webPort = getConfig(CouchbaseNode.COUCHBASE_WEB_ADMIN_PORT).iterator().next().toString();
-                    setAttribute(CouchbaseNode.COUCHBASE_WEB_ADMIN_URL, format("http://%s:%s",
hostname, webPort));
+                    Integer webPort = getAttribute(CouchbaseNode.COUCHBASE_WEB_ADMIN_PORT);
+                    String hostAndPort = BrooklynAccessUtils.getBrooklynAccessibleAddress(CouchbaseNodeImpl.this,
webPort).toString();
+                    setAttribute(CouchbaseNode.COUCHBASE_WEB_ADMIN_URL, format("http://%s",
hostAndPort));
                 }
             }
         });
@@ -197,7 +197,7 @@ public class CouchbaseNodeImpl extends SoftwareProcessImpl implements
CouchbaseN
         Preconditions.checkNotNull(rawPort, "HTTP_PORT sensors not set for %s; is an acceptable
port available?", this);
         HostAndPort hp = BrooklynAccessUtils.getBrooklynAccessibleAddress(this, rawPort);
         
-        String adminUrl = String.format("http://%s:%s", hp.getHostText(), hp.getPort());
+        String adminUrl = String.format("http://%s", hp.toString());
         
         httpFeed = HttpFeed.builder()
             .entity(this)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b1581fe8/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
index 56a8623..aaceae4 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
@@ -145,7 +145,7 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver
imp
                 "for i in {0..120}\n" +
                 "do\n" +
                 "    if [ $i -eq 120 ]; then echo REST API unavailable after 120 seconds,
failing; exit 1; fi;\n" +
-                "    curl -s " + String.format("http://%s:%s", getHostname(), getWebPort())
+ " > /dev/null && echo REST API available after $i seconds && break\n"
+
+                "    curl -s " + String.format("http://localhost:%s", getWebPort()) + " >
/dev/null && echo REST API available after $i seconds && break\n" +
                 "    sleep 1\n" +
                 "done\n" +
                 couchbaseCli("cluster-init") +
@@ -161,7 +161,7 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver
imp
     public boolean isRunning() {
         //TODO add a better way to check if couchbase server is running
         return (newScript(CHECK_RUNNING)
-                .body.append(format("curl -u %s:%s http://%s:%s/pools/nodes", getUsername(),
getPassword(), getHostname(), getWebPort()))
+                .body.append(format("curl -u %s:%s http://localhost:%s/pools/nodes", getUsername(),
getPassword(), getWebPort()))
                 .execute() == 0);
     }
 
@@ -205,11 +205,11 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver
imp
     }
 
     private String getCouchbaseHostnameAndCredentials() {
-        return format("-c %s:%s -u %s -p %s", getHostname(), getWebPort(), getUsername(),
getPassword());
+        return format("-c localhost:%s -u %s -p %s", getWebPort(), getUsername(), getPassword());
     }
 
     private String getCouchbaseHostnameAndPort() {
-        return format("-c %s:%s", getHostname(), getWebPort());
+        return format("-c localhost:%s", getWebPort());
     }
 
     private String getClusterInitRamSize() {


Mime
View raw message