/** * Returns the iptables rules. * * @return Returns the command that list all the iptables rules. */ public static String listIptablesRule() { return sudo("/sbin/iptables -L -v -n"); }
protected static String cdAndRun(String targetDirectory, String command) { return BashCommands.chain("mkdir -p "+targetDirectory, "cd "+targetDirectory, command); }
/** * Adds the PPA for OpenJDK for older JDK versions (7 and lower) required by some software (e.g. JBoss) */ public static String addOpenJDKPPK(){ return chainGroup( sudo("sudo add-apt-repository -y ppa:openjdk-r/ppa"), sudo("sudo apt-get update")); }
private String getZypperRepository() { return chainGroup( ok(sudo("zypper --non-interactive addrepo http://download.opensuse.org/repositories/devel:/languages:/erlang/SLE_11_SP3 erlang_sles_11")), ok(sudo("zypper --non-interactive addrepo http://download.opensuse.org/repositories/devel:/languages:/erlang/openSUSE_11.4 erlang_suse_11")), ok(sudo("zypper --non-interactive addrepo http://download.opensuse.org/repositories/devel:/languages:/erlang/openSUSE_12.3 erlang_suse_12")), ok(sudo("zypper --non-interactive addrepo http://download.opensuse.org/repositories/devel:/languages:/erlang/openSUSE_13.1 erlang_suse_13"))); } }
public static String installJava7Or6OrFail() { return alternatives(installJava7(), installJava6(), fail("java install failed", 9)); } public static String installJavaLatestOrFail() {
/** * Returns a string for checking whether the given executable is available, * and installing it if necessary. * <p/> * Uses {@link #installPackage} and accepts the same flags e.g. for apt, yum, rpm. */ public static String installExecutable(Map<?,?> flags, String executable) { return onlyIfExecutableMissing(executable, installPackage(flags, executable)); }
public static String installJava7IfPossible() { return ok(installJava7()); } public static String installJava8IfPossible() {
/** @deprecated since 0.7.0; use {@link #insertIptablesRule(Chain, String, org.apache.brooklyn.util.net.Protocol, int, Policy)} */ @Deprecated public static String insertIptablesRule(Chain chain, String networkInterface, Protocol protocol, int port, Policy policy) { return insertIptablesRule(chain, networkInterface, protocol.convert(), port, policy); }
/** requires the command to have a non-zero exit code; e.g. * <code>require("which foo", "Command foo must be found", 1)</code> */ public static String require(String command, String failureMessage, int exitCode) { return alternativesGroup(command, fail(failureMessage, exitCode)); }
/** @deprecated since 0.7.0; use {@link #appendIptablesRule(Chain, org.apache.brooklyn.util.net.Protocol, int, Policy)} */ @Deprecated public static String appendIptablesRule(Chain chain, Protocol protocol, int port, Policy policy) { return appendIptablesRule(chain, protocol.convert(), port, policy); }
/** requires the test to pass, as valid bash `test` arguments; e.g. * <code>requireTest("-f /etc/hosts", "Hosts file must exist", 1)</code> */ public static String requireTest(String test, String failureMessage, int exitCode) { return require("test "+test, failureMessage, exitCode); }
public static String installJava6() { return installJava(6); } public static String installJava7() {
/** @deprecated since 0.7.0; use {@link #addIptablesRule(String, Chain, Optional, org.apache.brooklyn.util.net.Protocol, int, Policy)} */ @Deprecated public static String addIptablesRule(String direction, Chain chain, Optional<String> networkInterface, Protocol protocol, int port, Policy policy) { return addIptablesRule(direction, chain, networkInterface, protocol.convert(), port, policy); }
/** * Same as {@link downloadUrlAs(List, String)}, except does not install curl, and does not exit on failure, * and if saveAs is null it downloads it so stdout. */ public static String simpleDownloadUrlAs(List<String> urls, String saveAs) { return simpleDownloadUrlAs(urls, null, null, saveAs); }
private String getAptRepository() { return chainGroup( sudo("apt-key adv --fetch-keys http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc"), "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" ); }
/** * Uses the curl-able install.sh script provided at {@code get.docker.com}. * This will install the latest version, which may be incompatible with the * jclouds driver. */ private String installDockerFallback() { return "curl -s https://get.docker.com/ | " + sudo("sh"); }
protected static String cdAndRun(String targetDirectory, String command) { return BashCommands.chain("mkdir -p "+targetDirectory, "cd "+targetDirectory, command); }
/** * Returns the command that cleans up iptables rules. * * @return Returns the command that cleans up iptables rules. */ public static String cleanUpIptablesRules() { return sudo("/sbin/iptables -F"); }
protected static String cdAndRun(String targetDirectory, String command) { return BashCommands.chain("mkdir -p '"+targetDirectory+"'", "cd '"+targetDirectory+"'", command); }
protected static String cdAndRun(String targetDirectory, String command) { return BashCommands.chain("mkdir -p '"+targetDirectory+"'", "cd '"+targetDirectory+"'", command); }