brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Added install resources configura...
Date Wed, 01 Oct 2014 15:16:39 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/165#discussion_r18285214
  
    --- Diff: software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java
---
    @@ -283,30 +284,95 @@ public int execute(Map flags2, List<String> script, String
summaryForLogging) {
             return getMachine().execScript(flags, summaryForLogging, script, environment);
         }
     
    +    /**
    +     * Files and templates to be copied to the server before install.
    +     * <p>
    +     * Will be prefixed with the entity's {@link #getInstallDir() install directory}
if relative.
    +     *
    +     * @see SoftwareProcess#INSTALL_FILES
    +     * @see SoftwareProcess#INSTALL_TEMPLATES
    +     */
         @Override
    -    public void resources() {
    -        Map runtimeFiles = entity.getConfig(SoftwareProcess.RUNTIME_FILES);
    -        copyResources(runtimeFiles);
    +    public void copyInstallResources() {
    +        try {
    +            getLocation().acquireMutex("installing "+elvis(entity,this),  "installation
lock at host for files and templates");
    +
    +            getLocation().execCommands("create install directory", ImmutableList.of("mkdir
-p " + getInstallDir()));
    +
    +            Map<String, String> installFiles = entity.getConfig(SoftwareProcess.INSTALL_FILES);
    +            if (installFiles != null && installFiles.size() > 0) {
    +                for (String source : installFiles.keySet()) {
    +                    String target = installFiles.get(source);
    +                    String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getInstallDir(),
target);
    +                    copyResource(source, destination, true);
    +                }
    +            }
     
    -        Map runtimeTemplates = entity.getConfig(SoftwareProcess.RUNTIME_TEMPLATES);
    -        copyTemplates(runtimeTemplates);
    +            Map<String, String> installTemplates = entity.getConfig(SoftwareProcess.INSTALL_TEMPLATES);
    +            if (installTemplates != null && installTemplates.size() > 0) {
    +                for (String source : installTemplates.keySet()) {
    +                    String target = installTemplates.get(source);
    +                    String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getInstallDir(),
target);
    +                    copyTemplate(source, destination, true, MutableMap.<String, Object>of());
    +                }
    +            }
    +        } catch (Exception e) {
    +            Exceptions.propagateIfFatal(e);
    --- End diff --
    
    Log the exception, rather than catching and ignoring.


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