You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by iyovcheva <gi...@git.apache.org> on 2016/05/05 15:24:36 UTC

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

GitHub user iyovcheva opened a pull request:

    https://github.com/apache/brooklyn-library/pull/33

    Allow creating roles for PostgreSQL

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/iyovcheva/brooklyn-library postgresql-roles

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-library/pull/33.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #33
    
----
commit d266a85cc4fc716d62e67a4231e67850475ac82b
Author: Ivana Yovcheva <iv...@gmail.com>
Date:   2016-05-04T16:13:38Z

    Allow creating roles for PostgreSQL

----


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r63860110
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNode.java ---
    @@ -90,6 +93,23 @@
                 String.class, "postgresql.username", "Username of the database user");
         
         String DEFAULT_USERNAME = "postgresqluser";
    +
    +    @SetFromFlag("roles")
    +    ConfigKey<Map<String, Map>> ROLES = new MapConfigKey(Map.class, "postgresql.roles",
    --- End diff --
    
    Can we have a test for this?


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

[GitHub] brooklyn-library issue #33: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the issue:

    https://github.com/apache/brooklyn-library/pull/33
  
    Thanks @iyovcheva - merging now.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62207804
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNode.java ---
    @@ -90,6 +95,29 @@
                 String.class, "postgresql.username", "Username of the database user");
         
         String DEFAULT_USERNAME = "postgresqluser";
    +
    +    @SetFromFlag("roles")
    +    ConfigKey<Map<String, Object>> ROLES = new MapConfigKey(Map.class, "postgresql.roles", "Initial roles with permissions",
    +            ImmutableMap.<String, Object>of(
    --- End diff --
    
    I'd leave the default empty - hard to predict the roles users will want.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62264240
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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", role.getKey()));
    --- End diff --
    
    Here and below, you shouldn't create SQL statements using string concatenation, that leaves you wide open to SQL injection attacks.  Instead use a prepared statement with appropriate bind variables, if at all possible.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by tbouron <gi...@git.apache.org>.
Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62215974
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNode.java ---
    @@ -90,6 +95,17 @@
                 String.class, "postgresql.username", "Username of the database user");
         
         String DEFAULT_USERNAME = "postgresqluser";
    +
    +    @SetFromFlag("roles")
    +    ConfigKey<Map<String, Map>> ROLES = new MapConfigKey(Map.class, "postgresql.roles",
    +            "Set roles with properties and permissions. Shoud be a map with keys equal to role names and values a map of the type:" +
    +                  "key equal to `properties` and value - the role properties that should be in the query after `WITH` statement" +
    +                    "key equal to `privileges` and value - the `GRANT` query value between the `GRANT` and `TO` statements"
    +    );
    --- End diff --
    
    Maybe worth to add an actual example within the description of what the map should look like?


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by iyovcheva <gi...@git.apache.org>.
Github user iyovcheva commented on the pull request:

    https://github.com/apache/brooklyn-library/pull/33#issuecomment-217430708
  
    Thanks @geomacy @tbouron @duncangrant 
    Using prepared statement requires big refactoring of the current code, because we generate and execute a script now and don't connect to the database in the code. Validating looks the simpler approach.


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

[GitHub] brooklyn-library pull request #33: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r66071993
  
    --- Diff: qa/src/test/resources/java-web-app-and-db-with-function.yaml ---
    @@ -17,18 +17,20 @@
     # under the License.
     #
     name: java-cluster-db-example
    -location: localhost
     services:
    -- type: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
    +- serviceType: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
       name: My Web
    -  wars.root: http://repo1.maven.org/maven2/org/apache/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.9.0/brooklyn-example-hello-world-sql-webapp-0.9.0.war
    -  http.port: 9280+
    -  proxy.http.port: 9210+
    -  java.sysprops: 
    -    brooklyn.example.db.url: $brooklyn:formatString("jdbc:%s%s?user=%s&password=%s",
    -       component("db").attributeWhenReady("datastore.url"), "visitors", "brooklyn", "br00k11n")
    -
    -- type: org.apache.brooklyn.entity.database.mysql.MySqlNode
    +  location: localhost
    +  brooklyn.config:
    +    wars.root: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.7.0-M1/brooklyn-example-hello-world-sql-webapp-0.7.0-M1.war
    --- End diff --
    
    why change this url from the 0.9.0 to the 0.7.0-M1 version?!


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

[GitHub] brooklyn-library pull request #33: Allow creating roles for PostgreSQL

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/brooklyn-library/pull/33


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

[GitHub] brooklyn-library pull request #33: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r66071462
  
    --- Diff: qa/src/test/resources/java-web-app-and-db-with-function.yaml ---
    @@ -17,18 +17,20 @@
     # under the License.
     #
     name: java-cluster-db-example
    -location: localhost
     services:
    -- type: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
    +- serviceType: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
    --- End diff --
    
    Why change this? `type` should work as well. This file seems unrelated to the rest of the pull request.


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

[GitHub] brooklyn-library pull request #33: Allow creating roles for PostgreSQL

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r66079073
  
    --- Diff: software/database/pom.xml ---
    @@ -144,11 +144,24 @@
             </dependency>
     
             <dependency>
    +            <groupId>${jclouds.groupId}.provider</groupId>
    --- End diff --
    
    Maven test dependencies are not transitive. Need to be explicit about test dependencies.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by duncangrant <gi...@git.apache.org>.
Github user duncangrant commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62302094
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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", role.getKey()));
    --- End diff --
    
    I don't see the relevance.  This is a command populated from a blueprint where you can also add an database initialisation script that can do whatever you want.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by tbouron <gi...@git.apache.org>.
Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62302857
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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", role.getKey()));
    --- End diff --
    
    Ease of use I guess? Also, you could imagine to call this from an effector to create users and roles on the fly


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by iyovcheva <gi...@git.apache.org>.
Github user iyovcheva commented on the pull request:

    https://github.com/apache/brooklyn-library/pull/33#issuecomment-217200840
  
    Thanks @geomacy 


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62298938
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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", role.getKey()));
    --- End diff --
    
    Actually I'm not sure you're going to be able to use prepared statements with DDL like CREATE ROLE, at least not with Postgres.  (Worth a look to see whether it's supported anyway.)  At the very least, as Thomas says, you should be validating the input before using it in a statement.


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

[GitHub] brooklyn-library pull request #33: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r66078817
  
    --- Diff: software/database/pom.xml ---
    @@ -144,11 +144,24 @@
             </dependency>
     
             <dependency>
    +            <groupId>${jclouds.groupId}.provider</groupId>
    --- End diff --
    
    We already depend on `brooklyn-locations-jclouds`, which should bring in this dependency. Why did it need to be added?


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

[GitHub] brooklyn-library pull request #33: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r66078600
  
    --- Diff: software/database/pom.xml ---
    @@ -144,11 +144,24 @@
             </dependency>
     
             <dependency>
    +            <groupId>${jclouds.groupId}.provider</groupId>
    +            <artifactId>aws-ec2</artifactId>
    +            <version>${jclouds.version}</version>
    +            <scope>test</scope>
    +        </dependency>
    +
    +        <dependency>
                 <groupId>postgresql</groupId>
                 <artifactId>postgresql</artifactId>
                 <version>${postgresql.version}</version>
                 <scope>test</scope>
             </dependency>
    +        <dependency>
    +            <groupId>javax.ws.rs</groupId>
    +            <artifactId>javax.ws.rs-api</artifactId>
    +            <version>2.0.1</version>
    --- End diff --
    
    Why do we need to include `javax.ws.rs-api` now? Also, it should use `${jax-rs-api.version}` rather than hard-coding 2.0.1.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by iyovcheva <gi...@git.apache.org>.
Github user iyovcheva commented on the pull request:

    https://github.com/apache/brooklyn-library/pull/33#issuecomment-217558123
  
    I agree, the user writing the queries in the yaml is the one who's deploying the entity and creating the database and can do whatever would like with them. But if this code is used for effectors in future or reused for anything, it's good to be secure from now.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r63860899
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +342,51 @@ 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);
    +        StringBuilder builder = new StringBuilder("\"");
    +
    +        for (Map.Entry role: roles.entrySet()) {
    +            builder.append(String.format("CREATE ROLE %s", validateInput((String) role.getKey())));
    +            if (((Map) role.getValue()).containsKey(PostgreSqlNode.ROLE_PROPERTIES_KEY)) {
    +                builder.append(String.format(" WITH %s; ", validateInput((String) ((Map) role.getValue()).get("properties"))));
    +            } else {
    +                builder.append(";");
    +            }
    +
    +            if (((Map) role.getValue()).containsKey(PostgreSqlNode.ROLE_PRIVILEGES_KEY)) {
    +                if ( ((Map) role.getValue()).get(PostgreSqlNode.ROLE_PRIVILEGES_KEY) instanceof List) {
    +                    for (Object privilege: (List) ((Map) role.getValue()).get(PostgreSqlNode.ROLE_PRIVILEGES_KEY)) {
    +                        builder.append(String.format("GRANT %s TO %s; ", validateInput((String) privilege), validateInput((String) role.getKey())));
    +                    }
    +                } else {
    +                    builder.append(String.format("GRANT %s TO %s; ",
    +                            validateInput((String) ((Map) role.getValue()).get(PostgreSqlNode.ROLE_PRIVILEGES_KEY)), validateInput((String) role.getKey())));
    +                }
    +            }
    +        }
    +
    +        builder.append("\"");
    +
    +        return builder.toString();
    +    }
    +
    +    private String validateInput(String input) {
    +        String regex = "[A-Za-z_,\\s]+";
    +        Pattern pattern = Pattern.compile(regex);
    +        Matcher matcher = pattern.matcher(input);
    +
    +        if (matcher.find() && matcher.start() == 0 && matcher.end() == input.length()) {
    +            return input;
    +        }
    +
    +        return "";
    --- End diff --
    
    This seems like the wrong way to handle invalid input: we just return an empty string without logging any problem? And presumably the subsequent roles query would be invalid with missing role name etc, such as `CREATE ROLE  WITH ...`?


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

[GitHub] brooklyn-library issue #33: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the issue:

    https://github.com/apache/brooklyn-library/pull/33
  
    @iyovcheva I've opened https://github.com/iyovcheva/brooklyn-library/pull/1 for some additional changes to the roles code. Can you take a look and see what you think please?
    
    If you merge that, it should appear automatically on this 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.
---

[GitHub] brooklyn-library issue #33: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the issue:

    https://github.com/apache/brooklyn-library/pull/33
  
    @iyovcheva there's a merge conflict - can you rebase against master please?


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62326206
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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", role.getKey()));
    --- End diff --
    
    @duncangrant you're right, if you can add arbitrary instructions in a script there's no point in worrying about injection  - my original comment didn't take that into account, it was just a gut reaction to seeing constructed SQL text.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62207350
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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, Object> roles = entity.getConfig(PostgreSqlNode.ROLES);
    +        String createRolesQuery = "\"";
    +
    +        for (Map.Entry role: roles.entrySet()) {
    +            createRolesQuery = createRolesQuery.concat(String.format("CREATE ROLE %s", role.getKey()));
    +            if (((Map) role.getValue()).containsKey("properties")) {
    +                createRolesQuery = createRolesQuery.concat(String.format(" WITH %s; ", ((Map) role.getValue()).get("properties")));
    +            } else {
    +                createRolesQuery = createRolesQuery.concat(";");
    +            }
    +
    +            if (((Map) role.getValue()).containsKey("privilages")) {
    --- End diff --
    
    typo "privilages" -> "privileges" 


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by iyovcheva <gi...@git.apache.org>.
Github user iyovcheva commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62208621
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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, Object> roles = entity.getConfig(PostgreSqlNode.ROLES);
    +        String createRolesQuery = "\"";
    +
    +        for (Map.Entry role: roles.entrySet()) {
    +            createRolesQuery = createRolesQuery.concat(String.format("CREATE ROLE %s", role.getKey()));
    +            if (((Map) role.getValue()).containsKey("properties")) {
    +                createRolesQuery = createRolesQuery.concat(String.format(" WITH %s; ", ((Map) role.getValue()).get("properties")));
    +            } else {
    +                createRolesQuery = createRolesQuery.concat(";");
    +            }
    +
    +            if (((Map) role.getValue()).containsKey("privilages")) {
    --- End diff --
    
    Thanks @geomacy 
    Do you think the roles defaults are fine to be in brooklyn as they look pretty standard, not specific?


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by tbouron <gi...@git.apache.org>.
Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62216594
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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", role.getKey()));
    +            if (((Map) role.getValue()).containsKey(PostgreSqlNode.ROLE_PROPERTIES_KEY)) {
    +                createRolesQuery = createRolesQuery.concat(String.format(" WITH %s; ", ((Map) role.getValue()).get("properties")));
    +            } else {
    +                createRolesQuery = createRolesQuery.concat(";");
    +            }
    +
    +            if (((Map) role.getValue()).containsKey(PostgreSqlNode.ROLE_PRIVILEGES_KEY)) {
    +                if ( ((Map) role.getValue()).get(PostgreSqlNode.ROLE_PRIVILEGES_KEY) instanceof List) {
    +                    for (Object privilage: (List) ((Map) role.getValue()).get(PostgreSqlNode.ROLE_PRIVILEGES_KEY)) {
    +                        createRolesQuery = createRolesQuery.concat(String.format("GRANT %s TO %s; ", privilage, role.getKey()));
    --- End diff --
    
    s/privilage/privilege


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62207834
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNode.java ---
    @@ -90,6 +95,29 @@
                 String.class, "postgresql.username", "Username of the database user");
         
         String DEFAULT_USERNAME = "postgresqluser";
    +
    +    @SetFromFlag("roles")
    +    ConfigKey<Map<String, Object>> ROLES = new MapConfigKey(Map.class, "postgresql.roles", "Initial roles with permissions",
    +            ImmutableMap.<String, Object>of(
    +                    "Admin", ImmutableMap.of(
    +                            "properties", "SUPERUSER",
    +                            "privilages", "ALL PRIVILEGES ON ALL TABLES IN SCHEMA public"
    +                    ),
    +                    "Data_Modeler", ImmutableMap.of(
    +                            "properties", "CREATEDB CREATEROLE",
    +                            "privilages", "ALL PRIVILEGES ON ALL TABLES IN SCHEMA public"
    +                    ),
    +                    "Developer", ImmutableMap.of(
    +                            "privilages", ImmutableList.of("SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public",
    +                                    "EXECUTE ON ALL FUNCTIONS IN SCHEMA public")
    +                    ),
    +                    "Analyst", ImmutableMap.of(
    +                            "privilages", "SELECT ON ALL TABLES IN SCHEMA public"
    +                    )
    +            ));
    +
    +    @SetFromFlag("createRoles")
    +    ConfigKey<Boolean> CREATE_ROLES = ConfigKeys.newBooleanConfigKey("create.roles", "Should roles be created with database initialization", false);
    --- End diff --
    
    Do you really need this?   Why not just check if config key ROLES is not empty?


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

[GitHub] brooklyn-library pull request #33: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r66077096
  
    --- Diff: qa/src/test/resources/java-web-app-and-db-with-function.yaml ---
    @@ -21,12 +21,13 @@ location: localhost
     services:
     - type: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
       name: My Web
    -  wars.root: http://repo1.maven.org/maven2/org/apache/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.9.0/brooklyn-example-hello-world-sql-webapp-0.9.0.war
    -  http.port: 9280+
    -  proxy.http.port: 9210+
    -  java.sysprops: 
    -    brooklyn.example.db.url: $brooklyn:formatString("jdbc:%s%s?user=%s&password=%s",
    -       component("db").attributeWhenReady("datastore.url"), "visitors", "brooklyn", "br00k11n")
    +  brooklyn.config:
    --- End diff --
    
    I'm surprised this is needed, but it's most probably a good thing to include the `brooklyn.config`, so happy to merge.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by duncangrant <gi...@git.apache.org>.
Github user duncangrant commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62303117
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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", role.getKey()));
    --- End diff --
    
    Sorry - I meant I don't see the relevance of protecting against sql injection.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by tbouron <gi...@git.apache.org>.
Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62216578
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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", role.getKey()));
    +            if (((Map) role.getValue()).containsKey(PostgreSqlNode.ROLE_PROPERTIES_KEY)) {
    +                createRolesQuery = createRolesQuery.concat(String.format(" WITH %s; ", ((Map) role.getValue()).get("properties")));
    +            } else {
    +                createRolesQuery = createRolesQuery.concat(";");
    +            }
    +
    +            if (((Map) role.getValue()).containsKey(PostgreSqlNode.ROLE_PRIVILEGES_KEY)) {
    +                if ( ((Map) role.getValue()).get(PostgreSqlNode.ROLE_PRIVILEGES_KEY) instanceof List) {
    +                    for (Object privilage: (List) ((Map) role.getValue()).get(PostgreSqlNode.ROLE_PRIVILEGES_KEY)) {
    --- End diff --
    
    s/privilage/privilege


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by bostko <gi...@git.apache.org>.
Github user bostko commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62626449
  
    --- 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 = "\"";
    --- End diff --
    
    It is better to use `StringBuilder`.


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

[GitHub] brooklyn-library pull request #33: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r66081409
  
    --- Diff: software/database/pom.xml ---
    @@ -144,11 +144,24 @@
             </dependency>
     
             <dependency>
    +            <groupId>${jclouds.groupId}.provider</groupId>
    --- End diff --
    
    Confirmed that we can delete the aws-ec2 dependency, but we do need to keep the `javax.ws.rs-api` dependency for the live tests to work (in eclipse at least). We should change it to use `${jax-rs-api.version}` though.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by bostko <gi...@git.apache.org>.
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.
---

[GitHub] brooklyn-library issue #33: Allow creating roles for PostgreSQL

Posted by iyovcheva <gi...@git.apache.org>.
Github user iyovcheva commented on the issue:

    https://github.com/apache/brooklyn-library/pull/33
  
    retest this please


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

[GitHub] brooklyn-library issue #33: Allow creating roles for PostgreSQL

Posted by iyovcheva <gi...@git.apache.org>.
Github user iyovcheva commented on the issue:

    https://github.com/apache/brooklyn-library/pull/33
  
    @aledsage are you ok with merging this?
    I couldn't run the tests and after I resolve my issue with them, can make changes to `PostgreSqlInitializeDatabaseLiveTest` in another PR if needed.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r63860470
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -320,6 +324,16 @@ private void initializeNewDatabase() {
                     "\"CREATE DATABASE %s OWNER %s\"",
                     StringEscapes.escapeSql(getDatabaseName()),
                     StringEscapes.escapeSql(getUsername()));
    +
    +        String createRolesAdditionalCommand = "";
    +
    +        if (!entity.getConfig(PostgreSqlNode.ROLES).isEmpty()) {
    --- End diff --
    
    This looks like it will throw an NPE if `ROLES` config value has not been set (because it has no default value, such as an empty immutable map). Am I right?


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by tbouron <gi...@git.apache.org>.
Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r62295255
  
    --- Diff: software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java ---
    @@ -328,9 +340,39 @@ 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", role.getKey()));
    --- End diff --
    
    +1, always validate and escape input from the user, especially for SQL queries.


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

[GitHub] brooklyn-library pull request: Allow creating roles for PostgreSQL

Posted by nakomis <gi...@git.apache.org>.
Github user nakomis commented on the pull request:

    https://github.com/apache/brooklyn-library/pull/33#issuecomment-217438089
  
    I was a little late getting to this, but it looks like @tbouron, @geomacy, and @duncangrant  have already raised the concerns I had
    
    Still not completely convinced that this is required in addition to the database initialisation script. Any thoughts anyone?


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

[GitHub] brooklyn-library pull request #33: Allow creating roles for PostgreSQL

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-library/pull/33#discussion_r66071641
  
    --- Diff: qa/src/test/resources/java-web-app-and-db-with-function.yaml ---
    @@ -17,18 +17,20 @@
     # under the License.
     #
     name: java-cluster-db-example
    -location: localhost
     services:
    -- type: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
    +- serviceType: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
    --- End diff --
    
    The test `JavaWebAppsMatchingTest` works for me locally. Can you explain these changes please?


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