{"action":"created","comment":{"url":"https://api.github.com/repos/zulip/zulip-gci/pulls/comments/88906764","pull_request_review_id":9463512,"id":88906764,"diff_hunk":"@@ -0,0 +1,180 @@\n+# This script takes one argument: the name of the GitHub user for whom you want\n+# to create a Zulip developer environment. Requires Python 3.\n+#\n+# Requires python-digitalocean library:\n+# https://github.com/koalalorenzo/python-digitalocean\n+#\n+# Also requires Digital Ocean team membership for Zulip and api token:\n+# https://cloud.digitalocean.com/settings/api/tokens\n+#\n+# Copy conf.ini-template to conf.ini and populate with your api token.\n+#\n+# usage: python3 create.py <username>\n+\n+import sys\n+import configparser\n+import urllib.request\n+import json\n+import digitalocean\n+import time\n+import argparse\n+import os\n+\n+# initiation argument parser\n+parser = argparse.ArgumentParser(description='Create a Zulip dev droplet based.')\n+parser.add_argument(\"username\", help=\"Github username for whom you want to create a Zulip dev droplet\")\n+\n+def get_config():\n+    config = configparser.ConfigParser()\n+    config.read(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'conf.ini'))\n+    return config\n+\n+def user_exists(username):\n+    print(\"Checking to see if GitHub user {0} exists...\".format(username))\n+    apiurl_user = \"https://api.github.com/users/{0}\".format(username)\n+    try:\n+        response = urllib.request.urlopen(apiurl_user)\n+        userdata = json.loads(response.read().decode())\n+        print(\"...user exists!\")\n+        return True\n+    except urllib.error.HTTPError as err:\n+        print(err)\n+        print(\"Does the github user {0} exist?\".format(username))\n+        sys.exit(1)\n+\n+def get_keys(username):\n+    print(\"Checking to see that GitHub user has available public keys...\")\n+    apiurl_keys = \"https://api.github.com/users/{0}/keys\".format(username)\n+    try:\n+        response = urllib.request.urlopen(apiurl_keys)\n+        userkeys = json.loads(response.read().decode())\n+        print(\"...public keys found!\")\n+        return userkeys\n+    except urllib.error.HTTPError as err:\n+        print(err)\n+        print(\"Has user {0} added ssh keys to their github account?\".format(username))\n+        sys.exit(1)\n+\n+def fork_exists(username):\n+    print(\"Checking to see GitHub user has forked zulip/zulip...\")\n+    apiurl_fork = \"https://api.github.com/repos/{0}/zulip\".format(username)\n+    try:\n+        response = urllib.request.urlopen(apiurl_fork)\n+        userfork = json.loads(response.read().decode())\n+        print(\"...fork found!\")\n+        return True\n+    except urllib.error.HTTPError as err:\n+        print(err)\n+        print(\"Has user {0} forked zulip/zulip?\".format(username))\n+        sys.exit(1)\n+\n+def droplet_exists(my_token, username):","path":"remotedev/create.py","position":71,"original_position":71,"commit_id":"7e97fc0a216555a5339fe3d1b1d5cbb865eb8493","original_commit_id":"7e97fc0a216555a5339fe3d1b1d5cbb865eb8493","user":{"login":"showell","id":142908,"avatar_url":"https://avatars.githubusercontent.com/u/142908?v=3","gravatar_id":"","url":"https://api.github.com/users/showell","html_url":"https://github.com/showell","followers_url":"https://api.github.com/users/showell/followers","following_url":"https://api.github.com/users/showell/following{/other_user}","gists_url":"https://api.github.com/users/showell/gists{/gist_id}","starred_url":"https://api.github.com/users/showell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/showell/subscriptions","organizations_url":"https://api.github.com/users/showell/orgs","repos_url":"https://api.github.com/users/showell/repos","events_url":"https://api.github.com/users/showell/events{/privacy}","received_events_url":"https://api.github.com/users/showell/received_events","type":"User","site_admin":false},"body":"Since this method has side effects, I would call it something like `exit_early_if_droplet_exists`.","created_at":"2016-11-21T14:40:52Z","updated_at":"2016-11-21T14:55:55Z","html_url":"https://github.com/zulip/zulip-gci/pull/5#discussion_r88906764","pull_request_url":"https://api.github.com/repos/zulip/zulip-gci/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip-gci/pulls/comments/88906764"},"html":{"href":"https://github.com/zulip/zulip-gci/pull/5#discussion_r88906764"},"pull_request":{"href":"https://api.github.com/repos/zulip/zulip-gci/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/zulip/zulip-gci/pulls/5","id":94509064,"html_url":"https://github.com/zulip/zulip-gci/pull/5","diff_url":"https://github.com/zulip/zulip-gci/pull/5.diff","patch_url":"https://github.com/zulip/zulip-gci/pull/5.patch","issue_url":"https://api.github.com/repos/zulip/zulip-gci/issues/5","number":5,"state":"open","locked":false,"title":"Enable automated creation of remote Zulip dev environments.","user":{"login":"christi3k","id":104006,"avatar_url":"https://avatars.githubusercontent.com/u/104006?v=3","gravatar_id":"","url":"https://api.github.com/users/christi3k","html_url":"https://github.com/christi3k","followers_url":"https://api.github.com/users/christi3k/followers","following_url":"https://api.github.com/users/christi3k/following{/other_user}","gists_url":"https://api.github.com/users/christi3k/gists{/gist_id}","starred_url":"https://api.github.com/users/christi3k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christi3k/subscriptions","organizations_url":"https://api.github.com/users/christi3k/orgs","repos_url":"https://api.github.com/users/christi3k/repos","events_url":"https://api.github.com/users/christi3k/events{/privacy}","received_events_url":"https://api.github.com/users/christi3k/received_events","type":"User","site_admin":false},"body":"Rough script that enables creation of remote Zulip developer environment from the command line.\r\n\r\nRequires:\r\n- Python 3\r\n- [python-digitalocean](https://github.com/koalalorenzo/python-digitalocean) library\r\n- membership on Zulip Digital Ocean team (ask @christi3k or @timabbott)\r\n- Digital Ocean api token\r\n\r\nTested on macOS. Will test on Ubuntu tomorrow.","created_at":"2016-11-20T06:32:54Z","updated_at":"2016-11-21T14:55:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5cde020c72a2ced1230297365ee36adcc2144d4d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zulip/zulip-gci/pulls/5/commits","review_comments_url":"https://api.github.com/repos/zulip/zulip-gci/pulls/5/comments","review_comment_url":"https://api.github.com/repos/zulip/zulip-gci/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zulip/zulip-gci/issues/5/comments","statuses_url":"https://api.github.com/repos/zulip/zulip-gci/statuses/7e97fc0a216555a5339fe3d1b1d5cbb865eb8493","head":{"label":"christi3k:remote-dev","ref":"remote-dev","sha":"7e97fc0a216555a5339fe3d1b1d5cbb865eb8493","user":{"login":"christi3k","id":104006,"avatar_url":"https://avatars.githubusercontent.com/u/104006?v=3","gravatar_id":"","url":"https://api.github.com/users/christi3k","html_url":"https://github.com/christi3k","followers_url":"https://api.github.com/users/christi3k/followers","following_url":"https://api.github.com/users/christi3k/following{/other_user}","gists_url":"https://api.github.com/users/christi3k/gists{/gist_id}","starred_url":"https://api.github.com/users/christi3k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christi3k/subscriptions","organizations_url":"https://api.github.com/users/christi3k/orgs","repos_url":"https://api.github.com/users/christi3k/repos","events_url":"https://api.github.com/users/christi3k/events{/privacy}","received_events_url":"https://api.github.com/users/christi3k/received_events","type":"User","site_admin":false},"repo":{"id":74254496,"name":"zulip-gci","full_name":"christi3k/zulip-gci","owner":{"login":"christi3k","id":104006,"avatar_url":"https://avatars.githubusercontent.com/u/104006?v=3","gravatar_id":"","url":"https://api.github.com/users/christi3k","html_url":"https://github.com/christi3k","followers_url":"https://api.github.com/users/christi3k/followers","following_url":"https://api.github.com/users/christi3k/following{/other_user}","gists_url":"https://api.github.com/users/christi3k/gists{/gist_id}","starred_url":"https://api.github.com/users/christi3k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christi3k/subscriptions","organizations_url":"https://api.github.com/users/christi3k/orgs","repos_url":"https://api.github.com/users/christi3k/repos","events_url":"https://api.github.com/users/christi3k/events{/privacy}","received_events_url":"https://api.github.com/users/christi3k/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/christi3k/zulip-gci","description":"GCI project category descriptions","fork":true,"url":"https://api.github.com/repos/christi3k/zulip-gci","forks_url":"https://api.github.com/repos/christi3k/zulip-gci/forks","keys_url":"https://api.github.com/repos/christi3k/zulip-gci/keys{/key_id}","collaborators_url":"https://api.github.com/repos/christi3k/zulip-gci/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/christi3k/zulip-gci/teams","hooks_url":"https://api.github.com/repos/christi3k/zulip-gci/hooks","issue_events_url":"https://api.github.com/repos/christi3k/zulip-gci/issues/events{/number}","events_url":"https://api.github.com/repos/christi3k/zulip-gci/events","assignees_url":"https://api.github.com/repos/christi3k/zulip-gci/assignees{/user}","branches_url":"https://api.github.com/repos/christi3k/zulip-gci/branches{/branch}","tags_url":"https://api.github.com/repos/christi3k/zulip-gci/tags","blobs_url":"https://api.github.com/repos/christi3k/zulip-gci/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/christi3k/zulip-gci/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/christi3k/zulip-gci/git/refs{/sha}","trees_url":"https://api.github.com/repos/christi3k/zulip-gci/git/trees{/sha}","statuses_url":"https://api.github.com/repos/christi3k/zulip-gci/statuses/{sha}","languages_url":"https://api.github.com/repos/christi3k/zulip-gci/languages","stargazers_url":"https://api.github.com/repos/christi3k/zulip-gci/stargazers","contributors_url":"https://api.github.com/repos/christi3k/zulip-gci/contributors","subscribers_url":"https://api.github.com/repos/christi3k/zulip-gci/subscribers","subscription_url":"https://api.github.com/repos/christi3k/zulip-gci/subscription","commits_url":"https://api.github.com/repos/christi3k/zulip-gci/commits{/sha}","git_commits_url":"https://api.github.com/repos/christi3k/zulip-gci/git/commits{/sha}","comments_url":"https://api.github.com/repos/christi3k/zulip-gci/comments{/number}","issue_comment_url":"https://api.github.com/repos/christi3k/zulip-gci/issues/comments{/number}","contents_url":"https://api.github.com/repos/christi3k/zulip-gci/contents/{+path}","compare_url":"https://api.github.com/repos/christi3k/zulip-gci/compare/{base}...{head}","merges_url":"https://api.github.com/repos/christi3k/zulip-gci/merges","archive_url":"https://api.github.com/repos/christi3k/zulip-gci/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/christi3k/zulip-gci/downloads","issues_url":"https://api.github.com/repos/christi3k/zulip-gci/issues{/number}","pulls_url":"https://api.github.com/repos/christi3k/zulip-gci/pulls{/number}","milestones_url":"https://api.github.com/repos/christi3k/zulip-gci/milestones{/number}","notifications_url":"https://api.github.com/repos/christi3k/zulip-gci/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/christi3k/zulip-gci/labels{/name}","releases_url":"https://api.github.com/repos/christi3k/zulip-gci/releases{/id}","deployments_url":"https://api.github.com/repos/christi3k/zulip-gci/deployments","created_at":"2016-11-20T05:17:54Z","updated_at":"2016-11-20T05:17:55Z","pushed_at":"2016-11-20T19:11:10Z","git_url":"git://github.com/christi3k/zulip-gci.git","ssh_url":"git@github.com:christi3k/zulip-gci.git","clone_url":"https://github.com/christi3k/zulip-gci.git","svn_url":"https://github.com/christi3k/zulip-gci","homepage":null,"size":23,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"zulip:master","ref":"master","sha":"0171d3ffa8812dd75f36a4ee970384272e7fc5ef","user":{"login":"zulip","id":4921959,"avatar_url":"https://avatars.githubusercontent.com/u/4921959?v=3","gravatar_id":"","url":"https://api.github.com/users/zulip","html_url":"https://github.com/zulip","followers_url":"https://api.github.com/users/zulip/followers","following_url":"https://api.github.com/users/zulip/following{/other_user}","gists_url":"https://api.github.com/users/zulip/gists{/gist_id}","starred_url":"https://api.github.com/users/zulip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zulip/subscriptions","organizations_url":"https://api.github.com/users/zulip/orgs","repos_url":"https://api.github.com/users/zulip/repos","events_url":"https://api.github.com/users/zulip/events{/privacy}","received_events_url":"https://api.github.com/users/zulip/received_events","type":"Organization","site_admin":false},"repo":{"id":73507048,"name":"zulip-gci","full_name":"zulip/zulip-gci","owner":{"login":"zulip","id":4921959,"avatar_url":"https://avatars.githubusercontent.com/u/4921959?v=3","gravatar_id":"","url":"https://api.github.com/users/zulip","html_url":"https://github.com/zulip","followers_url":"https://api.github.com/users/zulip/followers","following_url":"https://api.github.com/users/zulip/following{/other_user}","gists_url":"https://api.github.com/users/zulip/gists{/gist_id}","starred_url":"https://api.github.com/users/zulip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zulip/subscriptions","organizations_url":"https://api.github.com/users/zulip/orgs","repos_url":"https://api.github.com/users/zulip/repos","events_url":"https://api.github.com/users/zulip/events{/privacy}","received_events_url":"https://api.github.com/users/zulip/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zulip/zulip-gci","description":"GCI project category descriptions","fork":false,"url":"https://api.github.com/repos/zulip/zulip-gci","forks_url":"https://api.github.com/repos/zulip/zulip-gci/forks","keys_url":"https://api.github.com/repos/zulip/zulip-gci/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zulip/zulip-gci/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zulip/zulip-gci/teams","hooks_url":"https://api.github.com/repos/zulip/zulip-gci/hooks","issue_events_url":"https://api.github.com/repos/zulip/zulip-gci/issues/events{/number}","events_url":"https://api.github.com/repos/zulip/zulip-gci/events","assignees_url":"https://api.github.com/repos/zulip/zulip-gci/assignees{/user}","branches_url":"https://api.github.com/repos/zulip/zulip-gci/branches{/branch}","tags_url":"https://api.github.com/repos/zulip/zulip-gci/tags","blobs_url":"https://api.github.com/repos/zulip/zulip-gci/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zulip/zulip-gci/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zulip/zulip-gci/git/refs{/sha}","trees_url":"https://api.github.com/repos/zulip/zulip-gci/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zulip/zulip-gci/statuses/{sha}","languages_url":"https://api.github.com/repos/zulip/zulip-gci/languages","stargazers_url":"https://api.github.com/repos/zulip/zulip-gci/stargazers","contributors_url":"https://api.github.com/repos/zulip/zulip-gci/contributors","subscribers_url":"https://api.github.com/repos/zulip/zulip-gci/subscribers","subscription_url":"https://api.github.com/repos/zulip/zulip-gci/subscription","commits_url":"https://api.github.com/repos/zulip/zulip-gci/commits{/sha}","git_commits_url":"https://api.github.com/repos/zulip/zulip-gci/git/commits{/sha}","comments_url":"https://api.github.com/repos/zulip/zulip-gci/comments{/number}","issue_comment_url":"https://api.github.com/repos/zulip/zulip-gci/issues/comments{/number}","contents_url":"https://api.github.com/repos/zulip/zulip-gci/contents/{+path}","compare_url":"https://api.github.com/repos/zulip/zulip-gci/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zulip/zulip-gci/merges","archive_url":"https://api.github.com/repos/zulip/zulip-gci/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zulip/zulip-gci/downloads","issues_url":"https://api.github.com/repos/zulip/zulip-gci/issues{/number}","pulls_url":"https://api.github.com/repos/zulip/zulip-gci/pulls{/number}","milestones_url":"https://api.github.com/repos/zulip/zulip-gci/milestones{/number}","notifications_url":"https://api.github.com/repos/zulip/zulip-gci/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zulip/zulip-gci/labels{/name}","releases_url":"https://api.github.com/repos/zulip/zulip-gci/releases{/id}","deployments_url":"https://api.github.com/repos/zulip/zulip-gci/deployments","created_at":"2016-11-11T19:55:33Z","updated_at":"2016-11-15T23:58:48Z","pushed_at":"2016-11-21T08:46:51Z","git_url":"git://github.com/zulip/zulip-gci.git","ssh_url":"git@github.com:zulip/zulip-gci.git","clone_url":"https://github.com/zulip/zulip-gci.git","svn_url":"https://github.com/zulip/zulip-gci","homepage":null,"size":36,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip-gci/pulls/5"},"html":{"href":"https://github.com/zulip/zulip-gci/pull/5"},"issue":{"href":"https://api.github.com/repos/zulip/zulip-gci/issues/5"},"comments":{"href":"https://api.github.com/repos/zulip/zulip-gci/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/zulip/zulip-gci/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/zulip/zulip-gci/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zulip/zulip-gci/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/zulip/zulip-gci/statuses/7e97fc0a216555a5339fe3d1b1d5cbb865eb8493"}}}}
{"actor":{"display_login":"showell"}}