You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by ahgittin <gi...@git.apache.org> on 2016/01/19 16:35:53 UTC

[GitHub] incubator-brooklyn pull request: RabbitMQ upgrade

Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1123#discussion_r50126875
  
    --- Diff: brooklyn-library/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitSshDriver.java ---
    @@ -205,4 +195,69 @@ public void kill() {
         private String getConfigPath() {
             return getRunDir() + "/rabbitmq";
         }
    +
    +    private String getYumRepository() {
    +        String yumRepoFileName = "erlang_solutions.repo";
    +        
    +        // Version and architecture are only required for download of epel package on RHEL/Centos systems so pick sensible
    +        // defaults if unavailable
    +        //
    +        // EPEL is still required as it is a prerequisite for the packages provided by Erlang Solutions
    +        
    +        String osMajorVersion = getMachine().getOsDetails().getVersion();
    +        if (Strings.isBlank(osMajorVersion)) {
    +            osMajorVersion = "7";
    +        } else {
    +            osMajorVersion = osMajorVersion.indexOf(".") > 0 ? osMajorVersion.substring(0, osMajorVersion.indexOf('.')) : osMajorVersion;
    +            if (!CENTOS_VERSION_TO_EPEL_VERSION.keySet().contains(osMajorVersion)) {
    +                osMajorVersion = "7";
    +            }
    +        }
    +        String epelVersion = CENTOS_VERSION_TO_EPEL_VERSION.get(osMajorVersion);
    +        String osArchitecture = getMachine().getOsDetails().getArch();
    +        if (Strings.isBlank(osArchitecture)) {
    +            osArchitecture = "x86_64";
    +        }
    +
    +        // Erlang Solutions provide separate packages for RHEL and CentOS, but they are hosted in a single repo.
    +        // E.g. - http://packages.erlang-solutions.com/rpm/centos/6/x86_64/
    +        // 
    +        // Erlang Solutions created a repo configuration RPM which can NOT be used on RedHat, because it has explicit checks for CentOS.
    +        // 
    +        // Bellow we are creating a repo file that works for CentOS and RedHat
    +        return chainGroup(
    +                sudo("yum -y update ca-certificates"),
    +                sudo("rpm -Uvh --replacepkgs " + format("http://download.fedoraproject.org/pub/epel/%s/%s/epel-release-%s.noarch.rpm", osMajorVersion, osArchitecture, epelVersion)),
    +                "( cat << 'EOF_BROOKLYN'\n"
    +                   + "[erlang-solutions]\n"
    +                   + "name=Centos / RHEL " + osMajorVersion + " - $basearch - Erlang Solutions\n"
    +                   + "baseurl=http://packages.erlang-solutions.com/rpm/centos/" + osMajorVersion + "/$basearch\n"
    +                   + "gpgcheck=0\n"
    +                   + "gpgkey=http://packages.erlang-solutions.com/debian/erlang_solutions.asc\n"
    +                   + "enabled=1\n"
    +                   + "EOF_BROOKLYN\n"
    +                   + ") > " + yumRepoFileName,
    +                  sudo(format("mv %s /etc/yum.repos.d/", yumRepoFileName)),
    +                  sudo(format("chown root:root /etc/yum.repos.d/%s", yumRepoFileName))
    +            );
    +    }
    +
    +    private String getAptRepository() {
    +        String debFileName = "erlang-repo.deb";
    +
    +        return chainGroup(
    +                INSTALL_WGET,
    +                format("wget --quiet -O %s %s", debFileName, entity.getConfig(RabbitBroker.ERLANG_DEB_REPO_URL)),
    +                sudo(format("dpkg -i %s", debFileName))
    +            );
    +    }
    +
    +    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")),
    --- End diff --
    
    @bostko You're probably right, but for another PR...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---