brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Brooklyn node and cluster upgrade
Date Fri, 31 Oct 2014 15:25:21 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/272#discussion_r19672833
  
    --- Diff: software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java
---
    @@ -76,18 +77,54 @@ protected String getPidFile() {
         
         @Override
         protected String getInstallLabelExtraSalt() {
    -        return Identifiers.makeIdFromHash(Objects.hashCode(entity.getConfig(BrooklynNode.DOWNLOAD_URL),
entity.getConfig(BrooklynNode.DISTRO_UPLOAD_URL)));
    +        String downloadUrl = entity.getConfig(BrooklynNode.DOWNLOAD_URL);
    +        String uploadUrl = entity.getConfig(BrooklynNode.DISTRO_UPLOAD_URL);
    +        if (Objects.equal(downloadUrl, BrooklynNode.DOWNLOAD_URL.getConfigKey().getDefaultValue())
&&
    +                Objects.equal(uploadUrl, BrooklynNode.DISTRO_UPLOAD_URL.getDefaultValue()))
{
    +            // if both are at the default value, then no salt
    +            return null;
    +        }
    +        return Identifiers.makeIdFromHash(Objects.hashCode(downloadUrl, uploadUrl));
         }
     
         @Override
         public void preInstall() {
             resolver = Entities.newDownloader(this);
             String subpath = entity.getConfig(BrooklynNode.SUBPATH_IN_ARCHIVE);
    -        if (Strings.isBlank(subpath)) subpath = format("brooklyn-%s", getVersion());
    +        if (subpath==null) {
    +            // assume the dir name is `basename-VERSION` where download link is `basename-VERSION-dist.tar.gz`
    +            String uploadUrl = entity.getConfig(BrooklynNode.DISTRO_UPLOAD_URL);
    +            String origDownloadName = uploadUrl;
    +            if (origDownloadName==null) { 
    +                String downloadUrlTemplate = entity.getAttribute(BrooklynNode.DOWNLOAD_URL);
    +                if (downloadUrlTemplate!=null) {
    +                    // BasicDownloadResolver makes it crazy hard to get the template-evaluated
value of DOWNLOAD_URL
    +                    origDownloadName = DownloadSubstituters.substitute(downloadUrlTemplate,
DownloadSubstituters.getBasicEntitySubstitutions(this));
    +                }
    +            }
    +            if (origDownloadName!=null) {
    +                origDownloadName = Urls.getBasename(origDownloadName);
    --- End diff --
    
    Make sure to unescape the url path before using it. I've hit this in actual usage.


---
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.
---

Mime
View raw message