Repository: incubator-brooklyn Updated Branches: refs/heads/master 6c4da4467 -> b03f77e92
Fix install-java on CentOS - Encountered with tomcatâs ec2 live test. Failed to install java7 because of problem described at http://serverfault.com/questions/637549/epel-repo-for-centos-6-causing-error?newreg=7c6019c0d0ae483c8bb3af387166ce49 Applied the fix described there. Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/d6311c22 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/d6311c22 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/d6311c22 Branch: refs/heads/master Commit: d6311c224ae2bc1ab3344cee349babc0dbf07031 Parents: c89d136 Author: Aled Sage <[email protected]> Authored: Tue Nov 24 13:23:32 2015 +0000 Committer: Aled Sage <[email protected]> Committed: Tue Nov 24 13:53:44 2015 +0000 ---------------------------------------------------------------------- .../org/apache/brooklyn/util/ssh/BashCommands.java | 3 +++ .../brooklyn/util/ssh/IptablesCommandsTest.java | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d6311c22/utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java ---------------------------------------------------------------------- diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java b/utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java index fcf45d8..eb082c2 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java @@ -375,11 +375,14 @@ public class BashCommands { ok(sudo("apt-get update")), sudo(aptInstall)))); if (yumInstall != null) + // Need to upgrade ca-certificates sometimes: + // http://serverfault.com/questions/637549/epel-repo-for-centos-6-causing-error?newreg=7c6019c0d0ae483c8bb3af387166ce49 commands.add(ifExecutableElse1("yum", chainGroup( "echo yum exists, doing update", ok(sudo("yum check-update")), ok(sudo("yum -y install epel-release")), + ok(sudo("yum upgrade -y ca-certificates --disablerepo=epel")), sudo(yumInstall)))); if (brewInstall != null) commands.add(ifExecutableElse1("brew", brewInstall)); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d6311c22/utils/common/src/test/java/org/apache/brooklyn/util/ssh/IptablesCommandsTest.java ---------------------------------------------------------------------- diff --git a/utils/common/src/test/java/org/apache/brooklyn/util/ssh/IptablesCommandsTest.java b/utils/common/src/test/java/org/apache/brooklyn/util/ssh/IptablesCommandsTest.java index 2d01ad1..29d80be 100644 --- a/utils/common/src/test/java/org/apache/brooklyn/util/ssh/IptablesCommandsTest.java +++ b/utils/common/src/test/java/org/apache/brooklyn/util/ssh/IptablesCommandsTest.java @@ -38,12 +38,19 @@ public class IptablesCommandsTest { private static final String appendIptablesRuleAll = "( if test \"$UID\" -eq 0; then ( /sbin/iptables -A INPUT -p tcp --dport 3306 -j ACCEPT ); " + "else sudo -E -n -S -- /sbin/iptables -A INPUT -p tcp --dport 3306 -j ACCEPT; fi )"; private static final String saveIptablesRules = "( ( if test \"$UID\" -eq 0; then ( service iptables save ); else sudo -E -n -S -- service iptables save; fi ) || " + - "( ( { which zypper && { echo zypper exists, doing refresh && (( if test \"$UID\" -eq 0; then ( zypper --non-interactive --no-gpg-checks refresh ); else sudo -E -n -S -- zypper --non-interactive --no-gpg-checks refresh; fi ) || true) && ( if test \"$UID\" -eq 0; then ( zypper --non-interactive --no-gpg-checks install iptables-persistent ); else sudo -E -n -S -- zypper --non-interactive --no-gpg-checks install iptables-persistent; fi ) ; } ; } || " + - "{ which apt-get && { echo apt-get exists, doing update && export DEBIAN_FRONTEND=noninteractive && (( if test \"$UID\" -eq 0; then ( apt-get update ); else sudo -E -n -S -- apt-get update; fi ) || true) && ( if test \"$UID\" -eq 0; then ( apt-get install -y --allow-unauthenticated iptables-persistent ); else sudo -E -n -S -- apt-get install -y --allow-unauthenticated iptables-persistent; fi ) ; } ; } || " + - "{ which yum && { echo yum exists, doing update && (( if test \"$UID\" -eq 0; then ( yum check-update ); else sudo -E -n -S -- yum check-update; fi ) || true) && (( if test \"$UID\" -eq 0; then ( yum -y install epel-release ); else sudo -E -n -S -- yum -y install epel-release; fi ) || true) && ( if test \"$UID\" -eq 0; then ( yum -y --nogpgcheck install iptables-persistent ); else sudo -E -n -S -- yum -y --nogpgcheck install iptables-persistent; fi ) ; } ; } || " + + "( ( { which zypper && { echo zypper exists, doing refresh && (( if test \"$UID\" -eq 0; then ( zypper --non-interactive --no-gpg-checks refresh ); else sudo -E -n -S -- zypper --non-interactive --no-gpg-checks refresh; fi ) || true) " + + "&& ( if test \"$UID\" -eq 0; then ( zypper --non-interactive --no-gpg-checks install iptables-persistent ); else sudo -E -n -S -- zypper --non-interactive --no-gpg-checks install iptables-persistent; fi ) ; } ; } || " + + "{ which apt-get && { echo apt-get exists, doing update && export DEBIAN_FRONTEND=noninteractive " + + "&& (( if test \"$UID\" -eq 0; then ( apt-get update ); else sudo -E -n -S -- apt-get update; fi ) || true) " + + "&& ( if test \"$UID\" -eq 0; then ( apt-get install -y --allow-unauthenticated iptables-persistent ); else sudo -E -n -S -- apt-get install -y --allow-unauthenticated iptables-persistent; fi ) ; } ; } || " + + "{ which yum && { echo yum exists, doing update && (( if test \"$UID\" -eq 0; then ( yum check-update ); else sudo -E -n -S -- yum check-update; fi ) || true) " + + "&& (( if test \"$UID\" -eq 0; then ( yum -y install epel-release ); else sudo -E -n -S -- yum -y install epel-release; fi ) || true) " + + "&& (( if test \"$UID\" -eq 0; then ( yum upgrade -y ca-certificates --disablerepo=epel ); else sudo -E -n -S -- yum upgrade -y ca-certificates --disablerepo=epel; fi ) || true) " + + "&& ( if test \"$UID\" -eq 0; then ( yum -y --nogpgcheck install iptables-persistent ); else sudo -E -n -S -- yum -y --nogpgcheck install iptables-persistent; fi ) ; } ; } || " + "{ which brew && brew install iptables-persistent ; } || " + "{ which port && ( if test \"$UID\" -eq 0; then ( port install iptables-persistent ); else sudo -E -n -S -- port install iptables-persistent; fi ) ; } || " + - "(( echo \"WARNING: no known/successful package manager to install iptables-persistent, may fail subsequently\" | tee /dev/stderr ) || true) ) && ( if test \"$UID\" -eq 0; then ( /etc/init.d/iptables-persistent save ); else sudo -E -n -S -- /etc/init.d/iptables-persistent save; fi ) ) )"; + "(( echo \"WARNING: no known/successful package manager to install iptables-persistent, may fail subsequently\" | tee /dev/stderr ) || true) ) " + + "&& ( if test \"$UID\" -eq 0; then ( /etc/init.d/iptables-persistent save ); else sudo -E -n -S -- /etc/init.d/iptables-persistent save; fi ) ) )"; @Test public void testCleanUpIptablesRules() {
