brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [07/13] brooklyn-library git commit: Use curl instead of wget in entities
Date Mon, 07 Mar 2016 09:32:37 GMT
Use curl instead of wget in entities


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

Branch: refs/heads/master
Commit: 39ed6e4c6ebb4ef035737311b26abb9bb7eaf85b
Parents: cbb58b9
Author: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>
Authored: Sat Mar 5 17:35:48 2016 +0000
Committer: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>
Committed: Sun Mar 6 20:31:52 2016 +0000

----------------------------------------------------------------------
 .../database/postgresql/PostgreSqlSshDriver.java  | 14 +++++++-------
 .../entity/messaging/rabbit/RabbitSshDriver.java  | 18 +++++++++++++-----
 .../network/bind/BindDnsServerSshDriver.java      |  4 ++--
 .../entity/nosql/riak/RiakNodeSshDriver.java      |  4 ++--
 .../entity/nosql/couchbase/pillowfight.yaml       |  8 +++++---
 5 files changed, 29 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/39ed6e4c/software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java
----------------------------------------------------------------------
diff --git a/software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java
b/software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java
index 059c348..8abe795 100644
--- a/software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java
+++ b/software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java
@@ -19,7 +19,7 @@
 package org.apache.brooklyn.entity.database.postgresql;
 
 import static java.lang.String.format;
-import static org.apache.brooklyn.util.ssh.BashCommands.INSTALL_WGET;
+import static org.apache.brooklyn.util.ssh.BashCommands.INSTALL_CURL;
 import static org.apache.brooklyn.util.ssh.BashCommands.alternativesGroup;
 import static org.apache.brooklyn.util.ssh.BashCommands.chainGroup;
 import static org.apache.brooklyn.util.ssh.BashCommands.dontRequireTtyForSudo;
@@ -216,17 +216,17 @@ public class PostgreSqlSshDriver extends AbstractSoftwareProcessSshDriver
implem
         }
 
         return chainGroup(
-                INSTALL_WGET,
-                sudo(format("wget http://yum.postgresql.org/%s/redhat/rhel-%s-%s/pgdg-%s%s-%s.noarch.rpm",
majorMinorVersion, osMajorVersion, arch, osName, shortVersion, version)),
-                sudo(format("rpm -Uvh pgdg-%s%s-%s.noarch.rpm", osName, shortVersion, version))
+                INSTALL_CURL,
+                sudo(format("curl http://yum.postgresql.org/%s/redhat/rhel-%s-%s/pgdg-%s%s-%s.noarch.rpm
-o pgdg.rpm", majorMinorVersion, osMajorVersion, arch, osName, shortVersion, version)),
+                sudo("rpm -Uvh pgdg.rpm")
             );
     }
 
     private String getAptRepository() {
         return chainGroup(
-                INSTALL_WGET,
-                "wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc |
sudo tee -a apt-key add -",
-                "echo \"deb http://apt.postgresql.org/pub/repos/apt/   $(sudo lsb_release
--codename --short)-pgdg main\" | sudo tee -a /etc/apt/sources.list.d/postgresql.list"
+                INSTALL_CURL,
+                "curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo tee -a
apt-key add",
+                "echo \"deb http://apt.postgresql.org/pub/repos/apt/ $(sudo lsb_release --codename
--short)-pgdg main\" | sudo tee -a /etc/apt/sources.list.d/postgresql.list"
             );
     }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/39ed6e4c/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitSshDriver.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitSshDriver.java
b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitSshDriver.java
index ad04d55..632bb05 100644
--- a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitSshDriver.java
+++ b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitSshDriver.java
@@ -19,7 +19,14 @@
 package org.apache.brooklyn.entity.messaging.rabbit;
 
 import static java.lang.String.format;
-import static org.apache.brooklyn.util.ssh.BashCommands.*;
+import static org.apache.brooklyn.util.ssh.BashCommands.INSTALL_CURL;
+import static org.apache.brooklyn.util.ssh.BashCommands.chainGroup;
+import static org.apache.brooklyn.util.ssh.BashCommands.commandsToDownloadUrlsAs;
+import static org.apache.brooklyn.util.ssh.BashCommands.ifExecutableElse0;
+import static org.apache.brooklyn.util.ssh.BashCommands.installExecutable;
+import static org.apache.brooklyn.util.ssh.BashCommands.installPackage;
+import static org.apache.brooklyn.util.ssh.BashCommands.ok;
+import static org.apache.brooklyn.util.ssh.BashCommands.sudo;
 
 import java.util.List;
 import java.util.Map;
@@ -37,6 +44,7 @@ import org.apache.brooklyn.entity.software.base.lifecycle.ScriptHelper;
 import org.apache.brooklyn.location.ssh.SshMachineLocation;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.net.Urls;
 import org.apache.brooklyn.util.os.Os;
 import org.apache.brooklyn.util.text.Strings;
 
@@ -45,7 +53,7 @@ import org.apache.brooklyn.util.text.Strings;
  */
 public class RabbitSshDriver extends AbstractSoftwareProcessSshDriver implements RabbitDriver
{
 
-    private static final Logger log = LoggerFactory.getLogger(RabbitSshDriver.class);
+    private static final Logger LOG = LoggerFactory.getLogger(RabbitSshDriver.class);
 
     // See http://fedoraproject.org/wiki/EPEL/FAQ#howtouse
     private static final Map<String, String> CENTOS_VERSION_TO_EPEL_VERSION = ImmutableMap.of(
@@ -58,7 +66,7 @@ public class RabbitSshDriver extends AbstractSoftwareProcessSshDriver implements
         super(entity, machine);
     }
 
-    protected String getLogFileLocation() { return getRunDir()+"/"+entity.getId()+".log";
}
+    protected String getLogFileLocation() { return Urls.mergePaths(getRunDir(), entity.getId()
+ ".log"); }
 
     public Integer getAmqpPort() { return entity.getAttribute(AmqpServer.AMQP_PORT); }
 
@@ -246,8 +254,8 @@ public class RabbitSshDriver extends AbstractSoftwareProcessSshDriver
implements
         String debFileName = "erlang-repo.deb";
 
         return chainGroup(
-                INSTALL_WGET,
-                format("wget --quiet -O %s %s", debFileName, entity.getConfig(RabbitBroker.ERLANG_DEB_REPO_URL)),
+                INSTALL_CURL,
+                format("curl %s -o %s", entity.config().get(RabbitBroker.ERLANG_DEB_REPO_URL),
debFileName),
                 sudo(format("dpkg -i %s", debFileName))
             );
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/39ed6e4c/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSshDriver.java
----------------------------------------------------------------------
diff --git a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSshDriver.java
b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSshDriver.java
index b9991c8..ad0aaff 100644
--- a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSshDriver.java
+++ b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSshDriver.java
@@ -84,8 +84,8 @@ public class BindDnsServerSshDriver extends AbstractSoftwareProcessSshDriver
imp
                 BashCommands.sudo("service iptables save"),
                 BashCommands.sudo("service iptables restart"));
         if (getEntity().getConfig(BindDnsServer.UPDATE_ROOT_ZONES_FILE)) {
-            commands.add("wget --user=ftp --password=ftp ftp://ftp.rs.internic.net/domain/db.cache
" +
-                    "-O " + getOsSupport().getRootZonesFile());
+            commands.add("curl --user=ftp:ftp ftp://ftp.rs.internic.net/domain/db.cache "
+
+                    "-o " + getOsSupport().getRootZonesFile());
         }
         newScript(CUSTOMIZING)
                 .body.append(commands)

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/39ed6e4c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
index 65879a7..04c7f75 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
@@ -175,12 +175,12 @@ public class RiakNodeSshDriver extends JavaSoftwareProcessSshDriver
implements R
                 ok(sudo("apt-get -y --allow-unauthenticated install logrotate libpam0g-dev
libssl0.9.8")),
                 "export OS_NAME=" + Strings.toLowerCase(osDetails.getName()),
                 "export OS_RELEASE=" + osReleaseCmd,
-                String.format("wget -O %s %s", saveAsApt, downloadUrl),
+                String.format("curl %s -o %s", downloadUrl, saveAsApt),
                 sudo(String.format("dpkg -i %s", saveAsApt)));
         String yum = chainGroup(
                 "which yum",
                 ok(sudo("yum -y install openssl")),
-                String.format("wget -O %s %s", saveAsYum, entity.getAttribute(RiakNode.DOWNLOAD_URL_RHEL_CENTOS)),
+                String.format("curl %s -o %s", entity.sensors().get(RiakNode.DOWNLOAD_URL_RHEL_CENTOS),
saveAsYum),
                 sudo(String.format("yum localinstall -y %s", saveAsYum)));
         return ImmutableList.<String>builder()
                 .add("mkdir -p " + installBin)

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/39ed6e4c/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/couchbase/pillowfight.yaml
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/couchbase/pillowfight.yaml
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/couchbase/pillowfight.yaml
index d91fcc9..e3127f8 100644
--- a/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/couchbase/pillowfight.yaml
+++ b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/couchbase/pillowfight.yaml
@@ -20,8 +20,9 @@ services:
 - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
   name: CBC Pillowfight
   launch.command: |
-    sudo wget -O/etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1204.list
-    sudo wget -O- http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add -
+    curl http://packages.couchbase.com/ubuntu/couchbase-ubuntu1204.list |
+      sudo tee /etc/apt/sources.list.d/couchbase.list
+    curl http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add -
     sudo apt-get update
     sudo apt-get install -y libcouchbase2-libevent libcouchbase-dev libcouchbase2-bin
   provisioning.properties:
@@ -72,6 +73,7 @@ services:
 
 # For CentOS, use the following launch command:
 #  launch.command: |
-#    sudo wget -O/etc/yum.repos.d/couchbase.repo http://packages.couchbase.com/rpm/couchbase-centos55-x86_64.repo
+#    curl http://packages.couchbase.com/rpm/couchbase-centos55-x86_64.repo |
+#      sudo tee /etc/yum.repos.d/couchbase.repo
 #    sudo yum check-update
 #    sudo yum install -y libcouchbase2-libevent libcouchbase-devel libcouchbase2-bin


Mime
View raw message