GitHub PullRequestReviewCommentEvent at 2014-06-13 04:10:39
Repository: pyfarm-agent
Actor: opalmer
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/comments/13737942","id":13737942,"diff_hunk":"@@ -0,0 +1,159 @@\n+# No shebang line, this module is meant to be imported\n+#\n+# Copyright 2014 Ambient Entertainment GmbH & Co. KG\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#    http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+import argparse\n+import os\n+import signal\n+import subprocess\n+import sys\n+import time\n+import zipfile\n+import shutil\n+\n+from os.path import join\n+\n+# Platform specific imports.  These should either all fail or\n+# import without problems so we're grouping them together.\n+try:\n+    from grp import getgrgid\n+    from pwd import getpwuid\n+    from os import setuid, getuid, setgid, getgid, fork\n+except ImportError:  # pragma: no cover\n+    getgrgid = NotImplemented\n+    getpwuid = NotImplemented\n+    setuid = NotImplemented\n+    getuid = NotImplemented\n+    setgid = NotImplemented\n+    getgid = NotImplemented\n+\n+from pyfarm.core.config import read_env\n+from pyfarm.agent.logger import getLogger\n+from pyfarm.agent.entrypoints.utility import start_daemon_posix\n+\n+logger = getLogger(\"agent.supervisor\")\n+\n+default_data_root = read_env(\"PYFARM_AGENT_DATA_ROOT\", \".pyfarm_agent\")\n+\n+\n+def supervisor():\n+    logger.debug(\"Supervisor called with: %r\", sys.argv)\n+\n+    supervisor_args = []\n+    agent_args = []\n+    in_agent_args = False\n+    tmp_argv = list(sys.argv)\n+    del tmp_argv[0]\n+    for arg in tmp_argv:\n+        if not in_agent_args and arg != \"--\":\n+            supervisor_args.append(arg)\n+        elif not in_agent_args and arg == \"--\":\n+            in_agent_args = True\n+        else:\n+            agent_args.append(arg)\n+\n+    logger.debug(\"supervisor_args: %s\", supervisor_args)\n+\n+    parser = argparse.ArgumentParser(description=\"Start and monitor the \"\n+                                        \"agent process\")\n+    parser.add_argument(\"--updates-drop-dir\", default=\"~/agent_updates\",\n+                        help=\"Where to look for agent updates\")\n+    parser.add_argument(\"--agent-package-dir\",\n+                        help=\"Path to the actual agent code\")\n+    parser.add_argument(\"--pidfile\", default=join(default_data_root,\n+                                                  \"supervisor.pid\"),\n+                        help=\"The file to store the process id in. \"\n+                             \"[default: %(default)s]\")\n+    parser.add_argument(\"-n\", \"--no-daemon\", default=False, action=\"store_true\",\n+                        help=\"If provided then do not run the process in the \"\n+                             \"background.\")\n+    parser.add_argument(\"--chroot\",\n+                        help=\"The directory to chroot to upon launch.\")\n+    parser.add_argument(\"--uid\", type=int,\n+                        help=\"The user id to run the supervisor as.  \"\n+                             \"*This setting is ignored on Windows.*\")\n+    parser.add_argument(\"--gid\", type=int,\n+                        help=\"The group id to run the supervisor as.  \"\n+                             \"*This setting is ignored on Windows.*\")\n+    args = parser.parse_args(supervisor_args)","path":"pyfarm/agent/entrypoints/supervisor.py","position":90,"original_position":90,"commit_id":"8bc5d0adc4bff8694cf4aaf857709c84399ed0e0","original_commit_id":"8bc5d0adc4bff8694cf4aaf857709c84399ed0e0","user":{"login":"opalmer","id":255117,"avatar_url":"https://avatars.githubusercontent.com/u/255117?","gravatar_id":"f921b2aa2b18f93626e92d94bf5d6b40","url":"https://api.github.com/users/opalmer","html_url":"https://github.com/opalmer","followers_url":"https://api.github.com/users/opalmer/followers","following_url":"https://api.github.com/users/opalmer/following{/other_user}","gists_url":"https://api.github.com/users/opalmer/gists{/gist_id}","starred_url":"https://api.github.com/users/opalmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opalmer/subscriptions","organizations_url":"https://api.github.com/users/opalmer/orgs","repos_url":"https://api.github.com/users/opalmer/repos","events_url":"https://api.github.com/users/opalmer/events{/privacy}","received_events_url":"https://api.github.com/users/opalmer/received_events","type":"User","site_admin":false},"body":"Based on the test above, you may want to change this too:\r\n\r\n```python\r\nargs, agent_args = parser.parser_known_args()\r\nif agent_args and agent_args[0] == \"--\":\r\n    del agent_args[0]\r\n```\r\n ","created_at":"2014-06-13T04:10:39Z","updated_at":"2014-06-13T04:10:39Z","html_url":"https://github.com/pyfarm/pyfarm-agent/pull/74#discussion_r13737942","pull_request_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/74","_links":{"self":{"href":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/comments/13737942"},"html":{"href":"https://github.com/pyfarm/pyfarm-agent/pull/74#discussion_r13737942"},"pull_request":{"href":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/74"}}},"pull_request":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/74","id":17067456,"html_url":"https://github.com/pyfarm/pyfarm-agent/pull/74","diff_url":"https://github.com/pyfarm/pyfarm-agent/pull/74.diff","patch_url":"https://github.com/pyfarm/pyfarm-agent/pull/74.patch","issue_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/74","number":74,"state":"open","title":"Supervisor","user":{"login":"guidow","id":6033185,"avatar_url":"https://avatars.githubusercontent.com/u/6033185?","gravatar_id":"08fdb7f22d1eb1256879baa634975346","url":"https://api.github.com/users/guidow","html_url":"https://github.com/guidow","followers_url":"https://api.github.com/users/guidow/followers","following_url":"https://api.github.com/users/guidow/following{/other_user}","gists_url":"https://api.github.com/users/guidow/gists{/gist_id}","starred_url":"https://api.github.com/users/guidow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidow/subscriptions","organizations_url":"https://api.github.com/users/guidow/orgs","repos_url":"https://api.github.com/users/guidow/repos","events_url":"https://api.github.com/users/guidow/events{/privacy}","received_events_url":"https://api.github.com/users/guidow/received_events","type":"User","site_admin":false},"body":"This is the first step towards agent auto-updates. The supervisor\r\nregularly checks if the agent is still running and, if not, restarts it.\r\n\r\nIf it finds an update in an update drop directory specified on the\r\ncommand line, it will apply it before starting the agent.\r\n\r\nCurrently, applying an update just means unpacking a zip file to a\r\nspecified location.","created_at":"2014-06-12T17:11:11Z","updated_at":"2014-06-13T04:10:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f94737716ece3559bd6335f81aa1f85f3aa95b4d","assignee":{"login":"guidow","id":6033185,"avatar_url":"https://avatars.githubusercontent.com/u/6033185?","gravatar_id":"08fdb7f22d1eb1256879baa634975346","url":"https://api.github.com/users/guidow","html_url":"https://github.com/guidow","followers_url":"https://api.github.com/users/guidow/followers","following_url":"https://api.github.com/users/guidow/following{/other_user}","gists_url":"https://api.github.com/users/guidow/gists{/gist_id}","starred_url":"https://api.github.com/users/guidow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidow/subscriptions","organizations_url":"https://api.github.com/users/guidow/orgs","repos_url":"https://api.github.com/users/guidow/repos","events_url":"https://api.github.com/users/guidow/events{/privacy}","received_events_url":"https://api.github.com/users/guidow/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/milestones/2","labels_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/milestones/2/labels","id":659564,"number":2,"title":"0.8.0","description":"","creator":{"login":"opalmer","id":255117,"avatar_url":"https://avatars.githubusercontent.com/u/255117?","gravatar_id":"f921b2aa2b18f93626e92d94bf5d6b40","url":"https://api.github.com/users/opalmer","html_url":"https://github.com/opalmer","followers_url":"https://api.github.com/users/opalmer/followers","following_url":"https://api.github.com/users/opalmer/following{/other_user}","gists_url":"https://api.github.com/users/opalmer/gists{/gist_id}","starred_url":"https://api.github.com/users/opalmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opalmer/subscriptions","organizations_url":"https://api.github.com/users/opalmer/orgs","repos_url":"https://api.github.com/users/opalmer/repos","events_url":"https://api.github.com/users/opalmer/events{/privacy}","received_events_url":"https://api.github.com/users/opalmer/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":24,"state":"open","created_at":"2014-05-15T04:22:55Z","updated_at":"2014-06-13T03:39:53Z","due_on":"2014-08-15T07:00:00Z"},"commits_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/74/commits","review_comments_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/74/comments","review_comment_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/comments/{number}","comments_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/74/comments","statuses_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/statuses/8bc5d0adc4bff8694cf4aaf857709c84399ed0e0","head":{"label":"guidow:supervisor","ref":"supervisor","sha":"8bc5d0adc4bff8694cf4aaf857709c84399ed0e0","user":{"login":"guidow","id":6033185,"avatar_url":"https://avatars.githubusercontent.com/u/6033185?","gravatar_id":"08fdb7f22d1eb1256879baa634975346","url":"https://api.github.com/users/guidow","html_url":"https://github.com/guidow","followers_url":"https://api.github.com/users/guidow/followers","following_url":"https://api.github.com/users/guidow/following{/other_user}","gists_url":"https://api.github.com/users/guidow/gists{/gist_id}","starred_url":"https://api.github.com/users/guidow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidow/subscriptions","organizations_url":"https://api.github.com/users/guidow/orgs","repos_url":"https://api.github.com/users/guidow/repos","events_url":"https://api.github.com/users/guidow/events{/privacy}","received_events_url":"https://api.github.com/users/guidow/received_events","type":"User","site_admin":false},"repo":{"id":14711845,"name":"pyfarm-agent","full_name":"guidow/pyfarm-agent","owner":{"login":"guidow","id":6033185,"avatar_url":"https://avatars.githubusercontent.com/u/6033185?","gravatar_id":"08fdb7f22d1eb1256879baa634975346","url":"https://api.github.com/users/guidow","html_url":"https://github.com/guidow","followers_url":"https://api.github.com/users/guidow/followers","following_url":"https://api.github.com/users/guidow/following{/other_user}","gists_url":"https://api.github.com/users/guidow/gists{/gist_id}","starred_url":"https://api.github.com/users/guidow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidow/subscriptions","organizations_url":"https://api.github.com/users/guidow/orgs","repos_url":"https://api.github.com/users/guidow/repos","events_url":"https://api.github.com/users/guidow/events{/privacy}","received_events_url":"https://api.github.com/users/guidow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/guidow/pyfarm-agent","description":"Core module containing code to run PyFarm's agent.","fork":true,"url":"https://api.github.com/repos/guidow/pyfarm-agent","forks_url":"https://api.github.com/repos/guidow/pyfarm-agent/forks","keys_url":"https://api.github.com/repos/guidow/pyfarm-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guidow/pyfarm-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guidow/pyfarm-agent/teams","hooks_url":"https://api.github.com/repos/guidow/pyfarm-agent/hooks","issue_events_url":"https://api.github.com/repos/guidow/pyfarm-agent/issues/events{/number}","events_url":"https://api.github.com/repos/guidow/pyfarm-agent/events","assignees_url":"https://api.github.com/repos/guidow/pyfarm-agent/assignees{/user}","branches_url":"https://api.github.com/repos/guidow/pyfarm-agent/branches{/branch}","tags_url":"https://api.github.com/repos/guidow/pyfarm-agent/tags","blobs_url":"https://api.github.com/repos/guidow/pyfarm-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guidow/pyfarm-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guidow/pyfarm-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/guidow/pyfarm-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guidow/pyfarm-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/guidow/pyfarm-agent/languages","stargazers_url":"https://api.github.com/repos/guidow/pyfarm-agent/stargazers","contributors_url":"https://api.github.com/repos/guidow/pyfarm-agent/contributors","subscribers_url":"https://api.github.com/repos/guidow/pyfarm-agent/subscribers","subscription_url":"https://api.github.com/repos/guidow/pyfarm-agent/subscription","commits_url":"https://api.github.com/repos/guidow/pyfarm-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/guidow/pyfarm-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/guidow/pyfarm-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/guidow/pyfarm-agent/issues/comments/{number}","contents_url":"https://api.github.com/repos/guidow/pyfarm-agent/contents/{+path}","compare_url":"https://api.github.com/repos/guidow/pyfarm-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guidow/pyfarm-agent/merges","archive_url":"https://api.github.com/repos/guidow/pyfarm-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guidow/pyfarm-agent/downloads","issues_url":"https://api.github.com/repos/guidow/pyfarm-agent/issues{/number}","pulls_url":"https://api.github.com/repos/guidow/pyfarm-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/guidow/pyfarm-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/guidow/pyfarm-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guidow/pyfarm-agent/labels{/name}","releases_url":"https://api.github.com/repos/guidow/pyfarm-agent/releases{/id}","created_at":"2013-11-26T09:05:01Z","updated_at":"2014-06-13T03:32:29Z","pushed_at":"2014-06-12T17:10:43Z","git_url":"git://github.com/guidow/pyfarm-agent.git","ssh_url":"git@github.com:guidow/pyfarm-agent.git","clone_url":"https://github.com/guidow/pyfarm-agent.git","svn_url":"https://github.com/guidow/pyfarm-agent","homepage":"","size":1878,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pyfarm:master","ref":"master","sha":"7624bbf14cd334ffc7d893f55511bd0629add459","user":{"login":"pyfarm","id":5248007,"avatar_url":"https://avatars.githubusercontent.com/u/5248007?","gravatar_id":"e58150e66e29c7509362bc2934436031","url":"https://api.github.com/users/pyfarm","html_url":"https://github.com/pyfarm","followers_url":"https://api.github.com/users/pyfarm/followers","following_url":"https://api.github.com/users/pyfarm/following{/other_user}","gists_url":"https://api.github.com/users/pyfarm/gists{/gist_id}","starred_url":"https://api.github.com/users/pyfarm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyfarm/subscriptions","organizations_url":"https://api.github.com/users/pyfarm/orgs","repos_url":"https://api.github.com/users/pyfarm/repos","events_url":"https://api.github.com/users/pyfarm/events{/privacy}","received_events_url":"https://api.github.com/users/pyfarm/received_events","type":"Organization","site_admin":false},"repo":{"id":13667312,"name":"pyfarm-agent","full_name":"pyfarm/pyfarm-agent","owner":{"login":"pyfarm","id":5248007,"avatar_url":"https://avatars.githubusercontent.com/u/5248007?","gravatar_id":"e58150e66e29c7509362bc2934436031","url":"https://api.github.com/users/pyfarm","html_url":"https://github.com/pyfarm","followers_url":"https://api.github.com/users/pyfarm/followers","following_url":"https://api.github.com/users/pyfarm/following{/other_user}","gists_url":"https://api.github.com/users/pyfarm/gists{/gist_id}","starred_url":"https://api.github.com/users/pyfarm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyfarm/subscriptions","organizations_url":"https://api.github.com/users/pyfarm/orgs","repos_url":"https://api.github.com/users/pyfarm/repos","events_url":"https://api.github.com/users/pyfarm/events{/privacy}","received_events_url":"https://api.github.com/users/pyfarm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pyfarm/pyfarm-agent","description":"Core module containing code to run PyFarm's agent.","fork":false,"url":"https://api.github.com/repos/pyfarm/pyfarm-agent","forks_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/forks","keys_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/teams","hooks_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/hooks","issue_events_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/events{/number}","events_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/events","assignees_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/assignees{/user}","branches_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/branches{/branch}","tags_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/tags","blobs_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/languages","stargazers_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/stargazers","contributors_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/contributors","subscribers_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/subscribers","subscription_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/subscription","commits_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/comments/{number}","contents_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/contents/{+path}","compare_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/merges","archive_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/downloads","issues_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues{/number}","pulls_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/labels{/name}","releases_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/releases{/id}","created_at":"2013-10-18T02:41:17Z","updated_at":"2014-06-13T03:34:05Z","pushed_at":"2014-06-13T03:34:05Z","git_url":"git://github.com/pyfarm/pyfarm-agent.git","ssh_url":"git@github.com:pyfarm/pyfarm-agent.git","clone_url":"https://github.com/pyfarm/pyfarm-agent.git","svn_url":"https://github.com/pyfarm/pyfarm-agent","homepage":"","size":4738,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":1,"mirror_url":null,"open_issues_count":22,"forks":1,"open_issues":22,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/74"},"html":{"href":"https://github.com/pyfarm/pyfarm-agent/pull/74"},"issue":{"href":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/74"},"comments":{"href":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/74/comments"},"review_comments":{"href":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/74/comments"},"review_comment":{"href":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/74/commits"},"statuses":{"href":"https://api.github.com/repos/pyfarm/pyfarm-agent/statuses/8bc5d0adc4bff8694cf4aaf857709c84399ed0e0"}}}}