brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorbett <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Adds template processing to the M...
Date Wed, 25 Feb 2015 10:39:06 GMT
Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/530#discussion_r25330734
  
    --- Diff: software/database/src/main/java/brooklyn/entity/database/mysql/MySqlSshDriver.java
---
    @@ -186,9 +186,13 @@ protected void copyDatabaseConfigScript() {
         }
     
         protected boolean copyDatabaseCreationScript() {
    -        InputStream creationScript = DatastoreMixins.getDatabaseCreationScript(entity);
    -        if (creationScript==null) return false;
    -        getMachine().copyTo(creationScript, getRunDir() + "/creation-script.sql");
    +        String creationScriptContents = DatastoreMixins.getDatabaseCreationScriptAsString(entity);
    +        if (creationScriptContents==null) return false;
    +
    +        creationScriptContents = processTemplateContents(creationScriptContents);
    +        Reader creationContents = new StringReader(creationScriptContents);
    +
    +        getMachine().copyTo(creationContents, getRunDir() + "/creation-script.sql");
    --- End diff --
    
    Although `copyTemplate` wants the URI of the template so its a bit awkward with `CREATION_SCRIPT_CONTENTS`.
I guess you'd have to write it out as a temporary file. I leave it up to you.


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