{"action":"created","comment":{"url":"https://api.github.com/repos/apache/brooklyn-library/pulls/comments/62303117","id":62303117,"diff_hunk":"@@ -328,9 +340,39 @@ private void initializeNewDatabase() {\n                         \" --command=\"+ createUserCommand),\n                 sudoAsUser(\"postgres\", getInstallDir() + \"/bin/psql -p \" + entity.getAttribute(PostgreSqlNode.POSTGRESQL_PORT) + \n                                 \" --command=\"+ createDatabaseCommand),\n+                createRolesAdditionalCommand,\n                 callPgctl(\"stop\", true))\n                 .failOnNonZeroResultCode().execute();\n     }\n+\n+    private String buildCreateRolesQuery() {\n+        Map<String, Map> roles = entity.getConfig(PostgreSqlNode.ROLES);\n+        String createRolesQuery = \"\\\"\";\n+\n+        for (Map.Entry role: roles.entrySet()) {\n+            createRolesQuery = createRolesQuery.concat(String.format(\"CREATE ROLE %s\", role.getKey()));","path":"software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java","position":40,"original_position":40,"commit_id":"f9e11872b174feb9af24766baf06316773e5b9d2","original_commit_id":"f9e11872b174feb9af24766baf06316773e5b9d2","user":{"login":"duncangrant","id":770352,"avatar_url":"https://avatars.githubusercontent.com/u/770352?v=3","gravatar_id":"","url":"https://api.github.com/users/duncangrant","html_url":"https://github.com/duncangrant","followers_url":"https://api.github.com/users/duncangrant/followers","following_url":"https://api.github.com/users/duncangrant/following{/other_user}","gists_url":"https://api.github.com/users/duncangrant/gists{/gist_id}","starred_url":"https://api.github.com/users/duncangrant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duncangrant/subscriptions","organizations_url":"https://api.github.com/users/duncangrant/orgs","repos_url":"https://api.github.com/users/duncangrant/repos","events_url":"https://api.github.com/users/duncangrant/events{/privacy}","received_events_url":"https://api.github.com/users/duncangrant/received_events","type":"User","site_admin":false},"body":"Sorry - I meant I don't see the relevance of protecting against sql injection.","created_at":"2016-05-06T08:44:42Z","updated_at":"2016-05-06T08:44:42Z","html_url":"https://github.com/apache/brooklyn-library/pull/33#discussion_r62303117","pull_request_url":"https://api.github.com/repos/apache/brooklyn-library/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/apache/brooklyn-library/pulls/comments/62303117"},"html":{"href":"https://github.com/apache/brooklyn-library/pull/33#discussion_r62303117"},"pull_request":{"href":"https://api.github.com/repos/apache/brooklyn-library/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/apache/brooklyn-library/pulls/33","id":69022782,"html_url":"https://github.com/apache/brooklyn-library/pull/33","diff_url":"https://github.com/apache/brooklyn-library/pull/33.diff","patch_url":"https://github.com/apache/brooklyn-library/pull/33.patch","issue_url":"https://api.github.com/repos/apache/brooklyn-library/issues/33","number":33,"state":"open","locked":false,"title":"Allow creating roles for PostgreSQL","user":{"login":"iyovcheva","id":4160133,"avatar_url":"https://avatars.githubusercontent.com/u/4160133?v=3","gravatar_id":"","url":"https://api.github.com/users/iyovcheva","html_url":"https://github.com/iyovcheva","followers_url":"https://api.github.com/users/iyovcheva/followers","following_url":"https://api.github.com/users/iyovcheva/following{/other_user}","gists_url":"https://api.github.com/users/iyovcheva/gists{/gist_id}","starred_url":"https://api.github.com/users/iyovcheva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iyovcheva/subscriptions","organizations_url":"https://api.github.com/users/iyovcheva/orgs","repos_url":"https://api.github.com/users/iyovcheva/repos","events_url":"https://api.github.com/users/iyovcheva/events{/privacy}","received_events_url":"https://api.github.com/users/iyovcheva/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-05T15:24:34Z","updated_at":"2016-05-06T08:44:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0196a24e6a70e022d99b787cdaf3ac3ebc046dc7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/brooklyn-library/pulls/33/commits","review_comments_url":"https://api.github.com/repos/apache/brooklyn-library/pulls/33/comments","review_comment_url":"https://api.github.com/repos/apache/brooklyn-library/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/brooklyn-library/issues/33/comments","statuses_url":"https://api.github.com/repos/apache/brooklyn-library/statuses/f9e11872b174feb9af24766baf06316773e5b9d2","head":{"label":"iyovcheva:postgresql-roles","ref":"postgresql-roles","sha":"f9e11872b174feb9af24766baf06316773e5b9d2","user":{"login":"iyovcheva","id":4160133,"avatar_url":"https://avatars.githubusercontent.com/u/4160133?v=3","gravatar_id":"","url":"https://api.github.com/users/iyovcheva","html_url":"https://github.com/iyovcheva","followers_url":"https://api.github.com/users/iyovcheva/followers","following_url":"https://api.github.com/users/iyovcheva/following{/other_user}","gists_url":"https://api.github.com/users/iyovcheva/gists{/gist_id}","starred_url":"https://api.github.com/users/iyovcheva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iyovcheva/subscriptions","organizations_url":"https://api.github.com/users/iyovcheva/orgs","repos_url":"https://api.github.com/users/iyovcheva/repos","events_url":"https://api.github.com/users/iyovcheva/events{/privacy}","received_events_url":"https://api.github.com/users/iyovcheva/received_events","type":"User","site_admin":false},"repo":{"id":52007356,"name":"brooklyn-library","full_name":"iyovcheva/brooklyn-library","owner":{"login":"iyovcheva","id":4160133,"avatar_url":"https://avatars.githubusercontent.com/u/4160133?v=3","gravatar_id":"","url":"https://api.github.com/users/iyovcheva","html_url":"https://github.com/iyovcheva","followers_url":"https://api.github.com/users/iyovcheva/followers","following_url":"https://api.github.com/users/iyovcheva/following{/other_user}","gists_url":"https://api.github.com/users/iyovcheva/gists{/gist_id}","starred_url":"https://api.github.com/users/iyovcheva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iyovcheva/subscriptions","organizations_url":"https://api.github.com/users/iyovcheva/orgs","repos_url":"https://api.github.com/users/iyovcheva/repos","events_url":"https://api.github.com/users/iyovcheva/events{/privacy}","received_events_url":"https://api.github.com/users/iyovcheva/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iyovcheva/brooklyn-library","description":"Mirror of Apache Brooklyn library","fork":true,"url":"https://api.github.com/repos/iyovcheva/brooklyn-library","forks_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/forks","keys_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/teams","hooks_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/hooks","issue_events_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/issues/events{/number}","events_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/events","assignees_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/assignees{/user}","branches_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/branches{/branch}","tags_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/tags","blobs_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/git/refs{/sha}","trees_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/statuses/{sha}","languages_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/languages","stargazers_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/stargazers","contributors_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/contributors","subscribers_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/subscribers","subscription_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/subscription","commits_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/commits{/sha}","git_commits_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/git/commits{/sha}","comments_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/comments{/number}","issue_comment_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/issues/comments{/number}","contents_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/contents/{+path}","compare_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/merges","archive_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/downloads","issues_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/issues{/number}","pulls_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/pulls{/number}","milestones_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/milestones{/number}","notifications_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/labels{/name}","releases_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/releases{/id}","deployments_url":"https://api.github.com/repos/iyovcheva/brooklyn-library/deployments","created_at":"2016-02-18T13:00:09Z","updated_at":"2016-02-18T13:00:12Z","pushed_at":"2016-05-05T16:20:35Z","git_url":"git://github.com/iyovcheva/brooklyn-library.git","ssh_url":"git@github.com:iyovcheva/brooklyn-library.git","clone_url":"https://github.com/iyovcheva/brooklyn-library.git","svn_url":"https://github.com/iyovcheva/brooklyn-library","homepage":null,"size":12798,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"9e7f637c32fa7984267b30774b5bfa832f9dd826","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":47246080,"name":"brooklyn-library","full_name":"apache/brooklyn-library","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/brooklyn-library","description":"Mirror of Apache Brooklyn library","fork":false,"url":"https://api.github.com/repos/apache/brooklyn-library","forks_url":"https://api.github.com/repos/apache/brooklyn-library/forks","keys_url":"https://api.github.com/repos/apache/brooklyn-library/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/brooklyn-library/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/brooklyn-library/teams","hooks_url":"https://api.github.com/repos/apache/brooklyn-library/hooks","issue_events_url":"https://api.github.com/repos/apache/brooklyn-library/issues/events{/number}","events_url":"https://api.github.com/repos/apache/brooklyn-library/events","assignees_url":"https://api.github.com/repos/apache/brooklyn-library/assignees{/user}","branches_url":"https://api.github.com/repos/apache/brooklyn-library/branches{/branch}","tags_url":"https://api.github.com/repos/apache/brooklyn-library/tags","blobs_url":"https://api.github.com/repos/apache/brooklyn-library/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/brooklyn-library/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/brooklyn-library/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/brooklyn-library/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/brooklyn-library/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/brooklyn-library/languages","stargazers_url":"https://api.github.com/repos/apache/brooklyn-library/stargazers","contributors_url":"https://api.github.com/repos/apache/brooklyn-library/contributors","subscribers_url":"https://api.github.com/repos/apache/brooklyn-library/subscribers","subscription_url":"https://api.github.com/repos/apache/brooklyn-library/subscription","commits_url":"https://api.github.com/repos/apache/brooklyn-library/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/brooklyn-library/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/brooklyn-library/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/brooklyn-library/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/brooklyn-library/contents/{+path}","compare_url":"https://api.github.com/repos/apache/brooklyn-library/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/brooklyn-library/merges","archive_url":"https://api.github.com/repos/apache/brooklyn-library/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/brooklyn-library/downloads","issues_url":"https://api.github.com/repos/apache/brooklyn-library/issues{/number}","pulls_url":"https://api.github.com/repos/apache/brooklyn-library/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/brooklyn-library/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/brooklyn-library/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/brooklyn-library/labels{/name}","releases_url":"https://api.github.com/repos/apache/brooklyn-library/releases{/id}","deployments_url":"https://api.github.com/repos/apache/brooklyn-library/deployments","created_at":"2015-12-02T08:00:06Z","updated_at":"2016-04-08T15:01:03Z","pushed_at":"2016-05-05T16:20:35Z","git_url":"git://github.com/apache/brooklyn-library.git","ssh_url":"git@github.com:apache/brooklyn-library.git","clone_url":"https://github.com/apache/brooklyn-library.git","svn_url":"https://github.com/apache/brooklyn-library","homepage":null,"size":12851,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":27,"mirror_url":"git://git.apache.org/brooklyn-library.git","open_issues_count":2,"forks":27,"open_issues":2,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/brooklyn-library/pulls/33"},"html":{"href":"https://github.com/apache/brooklyn-library/pull/33"},"issue":{"href":"https://api.github.com/repos/apache/brooklyn-library/issues/33"},"comments":{"href":"https://api.github.com/repos/apache/brooklyn-library/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/brooklyn-library/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/brooklyn-library/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/brooklyn-library/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/apache/brooklyn-library/statuses/f9e11872b174feb9af24766baf06316773e5b9d2"}}}}