brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bostko <...@git.apache.org>
Subject [GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL
Date Tue, 10 May 2016 07:58:02 GMT
Github user bostko commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62626911
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java
---
    @@ -328,9 +342,52 @@ private void initializeNewDatabase() {
                             " --command="+ createUserCommand),
                     sudoAsUser("postgres", getInstallDir() + "/bin/psql -p " + entity.getAttribute(PostgreSqlNode.POSTGRESQL_PORT)
+ 
                                     " --command="+ createDatabaseCommand),
    +                createRolesAdditionalCommand,
                     callPgctl("stop", true))
                     .failOnNonZeroResultCode().execute();
         }
    +
    +    private String buildCreateRolesQuery() {
    +        Map<String, Map> roles = entity.getConfig(PostgreSqlNode.ROLES);
    +        String createRolesQuery = "\"";
    +
    +        for (Map.Entry role: roles.entrySet()) {
    +            createRolesQuery = createRolesQuery.concat(String.format("CREATE ROLE %s",
validateInput((String) role.getKey())));
    --- End diff --
    
    Most of the people use `+=` instead of `concat`


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