{"action":"created","comment":{"url":"https://api.github.com/repos/prestodb/presto-admin/pulls/comments/57768016","id":57768016,"diff_hunk":"@@ -37,11 +38,30 @@\n COULD_NOT_REMOVE = 'Could not remove connector'\n \n \n-def deploy_files(filenames, local_dir, remote_dir):\n+def deploy_files(filenames, local_dir, remote_dir, user_group, mode=0600):\n+    missing_owner_code = 42\n+    user, group = user_group.split(\":\")\n     _LOGGER.info('Deploying configurations for ' + str(filenames))\n     sudo('mkdir -p ' + remote_dir)\n     for name in filenames:\n-        put(os.path.join(local_dir, name), remote_dir, use_sudo=True)\n+        files = put(os.path.join(local_dir, name), remote_dir, use_sudo=True,\n+                    mode=mode)\n+        for file in files:\n+            with settings(warn_only=True):\n+                command = \\\n+                    \"getent passwd {user} >/dev/null || ( rm -f {file} ; \" \\","path":"prestoadmin/connector.py","position":34,"original_position":34,"commit_id":"2220029d4a1ef3b4ad8206f2dbd8447d6205d0b7","original_commit_id":"2220029d4a1ef3b4ad8206f2dbd8447d6205d0b7","user":{"login":"cawallin","id":3652644,"avatar_url":"https://avatars.githubusercontent.com/u/3652644?v=3","gravatar_id":"","url":"https://api.github.com/users/cawallin","html_url":"https://github.com/cawallin","followers_url":"https://api.github.com/users/cawallin/followers","following_url":"https://api.github.com/users/cawallin/following{/other_user}","gists_url":"https://api.github.com/users/cawallin/gists{/gist_id}","starred_url":"https://api.github.com/users/cawallin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cawallin/subscriptions","organizations_url":"https://api.github.com/users/cawallin/orgs","repos_url":"https://api.github.com/users/cawallin/repos","events_url":"https://api.github.com/users/cawallin/events{/privacy}","received_events_url":"https://api.github.com/users/cawallin/received_events","type":"User","site_admin":false},"body":"can you add commas around the || for clarity? I'm assuming that this check means that if the user doesn't exist, we fail to move the connector there, but it took a little while to parse.","created_at":"2016-03-29T17:50:19Z","updated_at":"2016-03-29T17:50:19Z","html_url":"https://github.com/prestodb/presto-admin/pull/171#discussion_r57768016","pull_request_url":"https://api.github.com/repos/prestodb/presto-admin/pulls/171","_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/comments/57768016"},"html":{"href":"https://github.com/prestodb/presto-admin/pull/171#discussion_r57768016"},"pull_request":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/171"}}},"pull_request":{"url":"https://api.github.com/repos/prestodb/presto-admin/pulls/171","id":64503234,"html_url":"https://github.com/prestodb/presto-admin/pull/171","diff_url":"https://github.com/prestodb/presto-admin/pull/171.diff","patch_url":"https://github.com/prestodb/presto-admin/pull/171.patch","issue_url":"https://api.github.com/repos/prestodb/presto-admin/issues/171","number":171,"state":"open","locked":false,"title":"Securely deploy config and connector files.","user":{"login":"ebd2","id":12751788,"avatar_url":"https://avatars.githubusercontent.com/u/12751788?v=3","gravatar_id":"","url":"https://api.github.com/users/ebd2","html_url":"https://github.com/ebd2","followers_url":"https://api.github.com/users/ebd2/followers","following_url":"https://api.github.com/users/ebd2/following{/other_user}","gists_url":"https://api.github.com/users/ebd2/gists{/gist_id}","starred_url":"https://api.github.com/users/ebd2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebd2/subscriptions","organizations_url":"https://api.github.com/users/ebd2/orgs","repos_url":"https://api.github.com/users/ebd2/repos","events_url":"https://api.github.com/users/ebd2/events{/privacy}","received_events_url":"https://api.github.com/users/ebd2/received_events","type":"User","site_admin":false},"body":"The configuration files and connector files we push to the presto coordinator and worker nodes can contain sensitive information. In particular, connector files can contain passwords. The ownership and permissions should be set such that only the presto user can access the files.","created_at":"2016-03-29T17:33:24Z","updated_at":"2016-03-29T17:50:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d53928b32af796783242f0363ecdd841f981ade","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/prestodb/presto-admin/pulls/171/commits","review_comments_url":"https://api.github.com/repos/prestodb/presto-admin/pulls/171/comments","review_comment_url":"https://api.github.com/repos/prestodb/presto-admin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prestodb/presto-admin/issues/171/comments","statuses_url":"https://api.github.com/repos/prestodb/presto-admin/statuses/2220029d4a1ef3b4ad8206f2dbd8447d6205d0b7","head":{"label":"Teradata:secure-config","ref":"secure-config","sha":"2220029d4a1ef3b4ad8206f2dbd8447d6205d0b7","user":{"login":"Teradata","id":1615979,"avatar_url":"https://avatars.githubusercontent.com/u/1615979?v=3","gravatar_id":"","url":"https://api.github.com/users/Teradata","html_url":"https://github.com/Teradata","followers_url":"https://api.github.com/users/Teradata/followers","following_url":"https://api.github.com/users/Teradata/following{/other_user}","gists_url":"https://api.github.com/users/Teradata/gists{/gist_id}","starred_url":"https://api.github.com/users/Teradata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Teradata/subscriptions","organizations_url":"https://api.github.com/users/Teradata/orgs","repos_url":"https://api.github.com/users/Teradata/repos","events_url":"https://api.github.com/users/Teradata/events{/privacy}","received_events_url":"https://api.github.com/users/Teradata/received_events","type":"Organization","site_admin":false},"repo":{"id":49295918,"name":"presto-admin","full_name":"Teradata/presto-admin","owner":{"login":"Teradata","id":1615979,"avatar_url":"https://avatars.githubusercontent.com/u/1615979?v=3","gravatar_id":"","url":"https://api.github.com/users/Teradata","html_url":"https://github.com/Teradata","followers_url":"https://api.github.com/users/Teradata/followers","following_url":"https://api.github.com/users/Teradata/following{/other_user}","gists_url":"https://api.github.com/users/Teradata/gists{/gist_id}","starred_url":"https://api.github.com/users/Teradata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Teradata/subscriptions","organizations_url":"https://api.github.com/users/Teradata/orgs","repos_url":"https://api.github.com/users/Teradata/repos","events_url":"https://api.github.com/users/Teradata/events{/privacy}","received_events_url":"https://api.github.com/users/Teradata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Teradata/presto-admin","description":"A tool to install, configure and manage Presto installations","fork":true,"url":"https://api.github.com/repos/Teradata/presto-admin","forks_url":"https://api.github.com/repos/Teradata/presto-admin/forks","keys_url":"https://api.github.com/repos/Teradata/presto-admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Teradata/presto-admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Teradata/presto-admin/teams","hooks_url":"https://api.github.com/repos/Teradata/presto-admin/hooks","issue_events_url":"https://api.github.com/repos/Teradata/presto-admin/issues/events{/number}","events_url":"https://api.github.com/repos/Teradata/presto-admin/events","assignees_url":"https://api.github.com/repos/Teradata/presto-admin/assignees{/user}","branches_url":"https://api.github.com/repos/Teradata/presto-admin/branches{/branch}","tags_url":"https://api.github.com/repos/Teradata/presto-admin/tags","blobs_url":"https://api.github.com/repos/Teradata/presto-admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Teradata/presto-admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Teradata/presto-admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/Teradata/presto-admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Teradata/presto-admin/statuses/{sha}","languages_url":"https://api.github.com/repos/Teradata/presto-admin/languages","stargazers_url":"https://api.github.com/repos/Teradata/presto-admin/stargazers","contributors_url":"https://api.github.com/repos/Teradata/presto-admin/contributors","subscribers_url":"https://api.github.com/repos/Teradata/presto-admin/subscribers","subscription_url":"https://api.github.com/repos/Teradata/presto-admin/subscription","commits_url":"https://api.github.com/repos/Teradata/presto-admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/Teradata/presto-admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/Teradata/presto-admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/Teradata/presto-admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/Teradata/presto-admin/contents/{+path}","compare_url":"https://api.github.com/repos/Teradata/presto-admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Teradata/presto-admin/merges","archive_url":"https://api.github.com/repos/Teradata/presto-admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Teradata/presto-admin/downloads","issues_url":"https://api.github.com/repos/Teradata/presto-admin/issues{/number}","pulls_url":"https://api.github.com/repos/Teradata/presto-admin/pulls{/number}","milestones_url":"https://api.github.com/repos/Teradata/presto-admin/milestones{/number}","notifications_url":"https://api.github.com/repos/Teradata/presto-admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Teradata/presto-admin/labels{/name}","releases_url":"https://api.github.com/repos/Teradata/presto-admin/releases{/id}","deployments_url":"https://api.github.com/repos/Teradata/presto-admin/deployments","created_at":"2016-01-08T20:59:23Z","updated_at":"2016-03-28T20:46:56Z","pushed_at":"2016-03-29T17:26:59Z","git_url":"git://github.com/Teradata/presto-admin.git","ssh_url":"git@github.com:Teradata/presto-admin.git","clone_url":"https://github.com/Teradata/presto-admin.git","svn_url":"https://github.com/Teradata/presto-admin","homepage":"http://www.teradata.com/presto","size":39206,"stargazers_count":27,"watchers_count":27,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":27,"default_branch":"master"}},"base":{"label":"prestodb:master","ref":"master","sha":"61a238e60264ca2c6a4489f2f740fe72defb79a7","user":{"login":"prestodb","id":6882181,"avatar_url":"https://avatars.githubusercontent.com/u/6882181?v=3","gravatar_id":"","url":"https://api.github.com/users/prestodb","html_url":"https://github.com/prestodb","followers_url":"https://api.github.com/users/prestodb/followers","following_url":"https://api.github.com/users/prestodb/following{/other_user}","gists_url":"https://api.github.com/users/prestodb/gists{/gist_id}","starred_url":"https://api.github.com/users/prestodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestodb/subscriptions","organizations_url":"https://api.github.com/users/prestodb/orgs","repos_url":"https://api.github.com/users/prestodb/repos","events_url":"https://api.github.com/users/prestodb/events{/privacy}","received_events_url":"https://api.github.com/users/prestodb/received_events","type":"Organization","site_admin":false},"repo":{"id":36050721,"name":"presto-admin","full_name":"prestodb/presto-admin","owner":{"login":"prestodb","id":6882181,"avatar_url":"https://avatars.githubusercontent.com/u/6882181?v=3","gravatar_id":"","url":"https://api.github.com/users/prestodb","html_url":"https://github.com/prestodb","followers_url":"https://api.github.com/users/prestodb/followers","following_url":"https://api.github.com/users/prestodb/following{/other_user}","gists_url":"https://api.github.com/users/prestodb/gists{/gist_id}","starred_url":"https://api.github.com/users/prestodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestodb/subscriptions","organizations_url":"https://api.github.com/users/prestodb/orgs","repos_url":"https://api.github.com/users/prestodb/repos","events_url":"https://api.github.com/users/prestodb/events{/privacy}","received_events_url":"https://api.github.com/users/prestodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prestodb/presto-admin","description":"A tool to install, configure and manage Presto installations","fork":false,"url":"https://api.github.com/repos/prestodb/presto-admin","forks_url":"https://api.github.com/repos/prestodb/presto-admin/forks","keys_url":"https://api.github.com/repos/prestodb/presto-admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prestodb/presto-admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prestodb/presto-admin/teams","hooks_url":"https://api.github.com/repos/prestodb/presto-admin/hooks","issue_events_url":"https://api.github.com/repos/prestodb/presto-admin/issues/events{/number}","events_url":"https://api.github.com/repos/prestodb/presto-admin/events","assignees_url":"https://api.github.com/repos/prestodb/presto-admin/assignees{/user}","branches_url":"https://api.github.com/repos/prestodb/presto-admin/branches{/branch}","tags_url":"https://api.github.com/repos/prestodb/presto-admin/tags","blobs_url":"https://api.github.com/repos/prestodb/presto-admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prestodb/presto-admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prestodb/presto-admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/prestodb/presto-admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prestodb/presto-admin/statuses/{sha}","languages_url":"https://api.github.com/repos/prestodb/presto-admin/languages","stargazers_url":"https://api.github.com/repos/prestodb/presto-admin/stargazers","contributors_url":"https://api.github.com/repos/prestodb/presto-admin/contributors","subscribers_url":"https://api.github.com/repos/prestodb/presto-admin/subscribers","subscription_url":"https://api.github.com/repos/prestodb/presto-admin/subscription","commits_url":"https://api.github.com/repos/prestodb/presto-admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/prestodb/presto-admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/prestodb/presto-admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/prestodb/presto-admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/prestodb/presto-admin/contents/{+path}","compare_url":"https://api.github.com/repos/prestodb/presto-admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prestodb/presto-admin/merges","archive_url":"https://api.github.com/repos/prestodb/presto-admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prestodb/presto-admin/downloads","issues_url":"https://api.github.com/repos/prestodb/presto-admin/issues{/number}","pulls_url":"https://api.github.com/repos/prestodb/presto-admin/pulls{/number}","milestones_url":"https://api.github.com/repos/prestodb/presto-admin/milestones{/number}","notifications_url":"https://api.github.com/repos/prestodb/presto-admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prestodb/presto-admin/labels{/name}","releases_url":"https://api.github.com/repos/prestodb/presto-admin/releases{/id}","deployments_url":"https://api.github.com/repos/prestodb/presto-admin/deployments","created_at":"2015-05-22T03:40:42Z","updated_at":"2016-03-22T02:22:57Z","pushed_at":"2016-03-29T17:33:24Z","git_url":"git://github.com/prestodb/presto-admin.git","ssh_url":"git@github.com:prestodb/presto-admin.git","clone_url":"https://github.com/prestodb/presto-admin.git","svn_url":"https://github.com/prestodb/presto-admin","homepage":"http://prestodb.github.io/presto-admin/","size":39434,"stargazers_count":40,"watchers_count":40,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":17,"forks":13,"open_issues":17,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/171"},"html":{"href":"https://github.com/prestodb/presto-admin/pull/171"},"issue":{"href":"https://api.github.com/repos/prestodb/presto-admin/issues/171"},"comments":{"href":"https://api.github.com/repos/prestodb/presto-admin/issues/171/comments"},"review_comments":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/171/comments"},"review_comment":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/171/commits"},"statuses":{"href":"https://api.github.com/repos/prestodb/presto-admin/statuses/2220029d4a1ef3b4ad8206f2dbd8447d6205d0b7"}}}}