GitHub PullRequestReviewCommentEvent at 2014-09-03 13:37:00
Repository: deuce
Actor: BenjamenMeyer
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/rackerlabs/deuce/pulls/comments/17048901","id":17048901,"diff_hunk":"@@ -0,0 +1,104 @@\n+import six\n+import base64\n+import binascii\n+import json\n+from pecan.hooks import PecanHook\n+from deuce.hooks import HealthHook\n+from pecan.core import abort\n+from deuce.drivers import swift\n+import deuce\n+\n+\n+class OpenStackObject(object):\n+    pass\n+\n+\n+class OpenStackSwiftHook(HealthHook):\n+    \"\"\"Every request that hits Deuce must have a header specifying the\n+    x-storage-url if running the swift storage driver\n+\n+    If a request does not provide the header the request should fail\n+    with a 401\"\"\"\n+\n+    def decode_service_catalog(self, catalog):\n+        \"\"\"Decode a JSON-based Base64 encoded Service Catalog\n+        \"\"\"\n+        try:\n+            utf8_data = base64.b64decode(catalog)\n+\n+        except binascii.Error:\n+            abort(412, comment=\"X-Service-Catalog invalid encoding\",\n+                  headers={\n+                      'Transaction-ID': deuce.context.transaction.request_id\n+                  })\n+\n+        try:\n+            json_data = json.loads(utf8_data)\n+        except ValueError:\n+            abort(412, comment=\"X-Service-Catalog: invalid format\",\n+                  headers={\n+                      'Transaction-ID': deuce.context.transaction.request_id\n+                  })\n+\n+        return json_data\n+\n+    def find_storage_url(self, catalog):\n+        try:\n+            main_catalog = catalog\n+            if 'access' in catalog:\n+                main_catalog = catalog['access']\n+\n+            service_catalog = main_catalog['serviceCatalog']","path":"deuce/hooks/openstackswifthook.py","position":51,"original_position":51,"commit_id":"b748474d3105cfd7127e3f5650e783620f5000f3","original_commit_id":"b748474d3105cfd7127e3f5650e783620f5000f3","user":{"login":"BenjamenMeyer","id":1074110,"avatar_url":"https://avatars.githubusercontent.com/u/1074110?v=2","gravatar_id":"6d8712967beef90b21957faec1e204ac","url":"https://api.github.com/users/BenjamenMeyer","html_url":"https://github.com/BenjamenMeyer","followers_url":"https://api.github.com/users/BenjamenMeyer/followers","following_url":"https://api.github.com/users/BenjamenMeyer/following{/other_user}","gists_url":"https://api.github.com/users/BenjamenMeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjamenMeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjamenMeyer/subscriptions","organizations_url":"https://api.github.com/users/BenjamenMeyer/orgs","repos_url":"https://api.github.com/users/BenjamenMeyer/repos","events_url":"https://api.github.com/users/BenjamenMeyer/events{/privacy}","received_events_url":"https://api.github.com/users/BenjamenMeyer/received_events","type":"User","site_admin":false},"body":"I know how I did it for EOM Auth, which is based on how Keystone Client does it. I do not know how Repose does it; so I just added that in order for the hook not to have to care. That's all.","created_at":"2014-09-03T13:37:00Z","updated_at":"2014-09-03T13:37:00Z","html_url":"https://github.com/rackerlabs/deuce/pull/119#discussion_r17048901","pull_request_url":"https://api.github.com/repos/rackerlabs/deuce/pulls/119","_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/deuce/pulls/comments/17048901"},"html":{"href":"https://github.com/rackerlabs/deuce/pull/119#discussion_r17048901"},"pull_request":{"href":"https://api.github.com/repos/rackerlabs/deuce/pulls/119"}}},"pull_request":{"url":"https://api.github.com/repos/rackerlabs/deuce/pulls/119","id":20644510,"html_url":"https://github.com/rackerlabs/deuce/pull/119","diff_url":"https://github.com/rackerlabs/deuce/pull/119.diff","patch_url":"https://github.com/rackerlabs/deuce/pull/119.patch","issue_url":"https://api.github.com/repos/rackerlabs/deuce/issues/119","number":119,"state":"open","locked":false,"title":"Enhancement hook storage url","user":{"login":"BenjamenMeyer","id":1074110,"avatar_url":"https://avatars.githubusercontent.com/u/1074110?v=2","gravatar_id":"6d8712967beef90b21957faec1e204ac","url":"https://api.github.com/users/BenjamenMeyer","html_url":"https://github.com/BenjamenMeyer","followers_url":"https://api.github.com/users/BenjamenMeyer/followers","following_url":"https://api.github.com/users/BenjamenMeyer/following{/other_user}","gists_url":"https://api.github.com/users/BenjamenMeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjamenMeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjamenMeyer/subscriptions","organizations_url":"https://api.github.com/users/BenjamenMeyer/orgs","repos_url":"https://api.github.com/users/BenjamenMeyer/repos","events_url":"https://api.github.com/users/BenjamenMeyer/events{/privacy}","received_events_url":"https://api.github.com/users/BenjamenMeyer/received_events","type":"User","site_admin":false},"body":"- Rename swifthook.py to openstackswifthook.py\r\n- Remove AuthToken usage from everywhere that is unnecessary\r\n- Disable the OpenStack and OpenStack Swift Hooks in default configuration\r\n- Update the OpenStack Swift Hook to get the Storage URL from the Base64 JSON UTF-8 encoded X-Service-Catalog header field\r\n- Add specific tests for the OpenStack and OpenStack Swift Hooks\r\n- Add a Datacenter field to the Deuce Context which the OpenStack Swift Hook uses to determine which Storage URL to store in the context\r\n- Removed unnecessary initialization of the Deuce Context, etc.","created_at":"2014-09-02T22:18:34Z","updated_at":"2014-09-03T13:37:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c34c67d32657b610a2e1ca25284c52f945bebb2b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rackerlabs/deuce/pulls/119/commits","review_comments_url":"https://api.github.com/repos/rackerlabs/deuce/pulls/119/comments","review_comment_url":"https://api.github.com/repos/rackerlabs/deuce/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rackerlabs/deuce/issues/119/comments","statuses_url":"https://api.github.com/repos/rackerlabs/deuce/statuses/b748474d3105cfd7127e3f5650e783620f5000f3","head":{"label":"BenjamenMeyer:enhancement_hook_storage_url","ref":"enhancement_hook_storage_url","sha":"b748474d3105cfd7127e3f5650e783620f5000f3","user":{"login":"BenjamenMeyer","id":1074110,"avatar_url":"https://avatars.githubusercontent.com/u/1074110?v=2","gravatar_id":"6d8712967beef90b21957faec1e204ac","url":"https://api.github.com/users/BenjamenMeyer","html_url":"https://github.com/BenjamenMeyer","followers_url":"https://api.github.com/users/BenjamenMeyer/followers","following_url":"https://api.github.com/users/BenjamenMeyer/following{/other_user}","gists_url":"https://api.github.com/users/BenjamenMeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjamenMeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjamenMeyer/subscriptions","organizations_url":"https://api.github.com/users/BenjamenMeyer/orgs","repos_url":"https://api.github.com/users/BenjamenMeyer/repos","events_url":"https://api.github.com/users/BenjamenMeyer/events{/privacy}","received_events_url":"https://api.github.com/users/BenjamenMeyer/received_events","type":"User","site_admin":false},"repo":{"id":20780300,"name":"deuce","full_name":"BenjamenMeyer/deuce","owner":{"login":"BenjamenMeyer","id":1074110,"avatar_url":"https://avatars.githubusercontent.com/u/1074110?v=2","gravatar_id":"6d8712967beef90b21957faec1e204ac","url":"https://api.github.com/users/BenjamenMeyer","html_url":"https://github.com/BenjamenMeyer","followers_url":"https://api.github.com/users/BenjamenMeyer/followers","following_url":"https://api.github.com/users/BenjamenMeyer/following{/other_user}","gists_url":"https://api.github.com/users/BenjamenMeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjamenMeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjamenMeyer/subscriptions","organizations_url":"https://api.github.com/users/BenjamenMeyer/orgs","repos_url":"https://api.github.com/users/BenjamenMeyer/repos","events_url":"https://api.github.com/users/BenjamenMeyer/events{/privacy}","received_events_url":"https://api.github.com/users/BenjamenMeyer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BenjamenMeyer/deuce","description":"Block-Level De-duplication as a Service","fork":true,"url":"https://api.github.com/repos/BenjamenMeyer/deuce","forks_url":"https://api.github.com/repos/BenjamenMeyer/deuce/forks","keys_url":"https://api.github.com/repos/BenjamenMeyer/deuce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BenjamenMeyer/deuce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BenjamenMeyer/deuce/teams","hooks_url":"https://api.github.com/repos/BenjamenMeyer/deuce/hooks","issue_events_url":"https://api.github.com/repos/BenjamenMeyer/deuce/issues/events{/number}","events_url":"https://api.github.com/repos/BenjamenMeyer/deuce/events","assignees_url":"https://api.github.com/repos/BenjamenMeyer/deuce/assignees{/user}","branches_url":"https://api.github.com/repos/BenjamenMeyer/deuce/branches{/branch}","tags_url":"https://api.github.com/repos/BenjamenMeyer/deuce/tags","blobs_url":"https://api.github.com/repos/BenjamenMeyer/deuce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BenjamenMeyer/deuce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BenjamenMeyer/deuce/git/refs{/sha}","trees_url":"https://api.github.com/repos/BenjamenMeyer/deuce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BenjamenMeyer/deuce/statuses/{sha}","languages_url":"https://api.github.com/repos/BenjamenMeyer/deuce/languages","stargazers_url":"https://api.github.com/repos/BenjamenMeyer/deuce/stargazers","contributors_url":"https://api.github.com/repos/BenjamenMeyer/deuce/contributors","subscribers_url":"https://api.github.com/repos/BenjamenMeyer/deuce/subscribers","subscription_url":"https://api.github.com/repos/BenjamenMeyer/deuce/subscription","commits_url":"https://api.github.com/repos/BenjamenMeyer/deuce/commits{/sha}","git_commits_url":"https://api.github.com/repos/BenjamenMeyer/deuce/git/commits{/sha}","comments_url":"https://api.github.com/repos/BenjamenMeyer/deuce/comments{/number}","issue_comment_url":"https://api.github.com/repos/BenjamenMeyer/deuce/issues/comments/{number}","contents_url":"https://api.github.com/repos/BenjamenMeyer/deuce/contents/{+path}","compare_url":"https://api.github.com/repos/BenjamenMeyer/deuce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BenjamenMeyer/deuce/merges","archive_url":"https://api.github.com/repos/BenjamenMeyer/deuce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BenjamenMeyer/deuce/downloads","issues_url":"https://api.github.com/repos/BenjamenMeyer/deuce/issues{/number}","pulls_url":"https://api.github.com/repos/BenjamenMeyer/deuce/pulls{/number}","milestones_url":"https://api.github.com/repos/BenjamenMeyer/deuce/milestones{/number}","notifications_url":"https://api.github.com/repos/BenjamenMeyer/deuce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BenjamenMeyer/deuce/labels{/name}","releases_url":"https://api.github.com/repos/BenjamenMeyer/deuce/releases{/id}","created_at":"2014-06-12T19:32:19Z","updated_at":"2014-07-11T14:18:39Z","pushed_at":"2014-09-02T22:12:30Z","git_url":"git://github.com/BenjamenMeyer/deuce.git","ssh_url":"git@github.com:BenjamenMeyer/deuce.git","clone_url":"https://github.com/BenjamenMeyer/deuce.git","svn_url":"https://github.com/BenjamenMeyer/deuce","homepage":null,"size":1730,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rackerlabs:master","ref":"master","sha":"2244d502821f2c7cc374afc8bbe3dc1471d2d535","user":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=2","gravatar_id":"cc2ad66c312c32facaf25a69bc6779cb","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":16175898,"name":"deuce","full_name":"rackerlabs/deuce","owner":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=2","gravatar_id":"cc2ad66c312c32facaf25a69bc6779cb","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackerlabs/deuce","description":"Block-Level De-duplication as a Service","fork":false,"url":"https://api.github.com/repos/rackerlabs/deuce","forks_url":"https://api.github.com/repos/rackerlabs/deuce/forks","keys_url":"https://api.github.com/repos/rackerlabs/deuce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackerlabs/deuce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackerlabs/deuce/teams","hooks_url":"https://api.github.com/repos/rackerlabs/deuce/hooks","issue_events_url":"https://api.github.com/repos/rackerlabs/deuce/issues/events{/number}","events_url":"https://api.github.com/repos/rackerlabs/deuce/events","assignees_url":"https://api.github.com/repos/rackerlabs/deuce/assignees{/user}","branches_url":"https://api.github.com/repos/rackerlabs/deuce/branches{/branch}","tags_url":"https://api.github.com/repos/rackerlabs/deuce/tags","blobs_url":"https://api.github.com/repos/rackerlabs/deuce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackerlabs/deuce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackerlabs/deuce/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackerlabs/deuce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackerlabs/deuce/statuses/{sha}","languages_url":"https://api.github.com/repos/rackerlabs/deuce/languages","stargazers_url":"https://api.github.com/repos/rackerlabs/deuce/stargazers","contributors_url":"https://api.github.com/repos/rackerlabs/deuce/contributors","subscribers_url":"https://api.github.com/repos/rackerlabs/deuce/subscribers","subscription_url":"https://api.github.com/repos/rackerlabs/deuce/subscription","commits_url":"https://api.github.com/repos/rackerlabs/deuce/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackerlabs/deuce/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackerlabs/deuce/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackerlabs/deuce/issues/comments/{number}","contents_url":"https://api.github.com/repos/rackerlabs/deuce/contents/{+path}","compare_url":"https://api.github.com/repos/rackerlabs/deuce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackerlabs/deuce/merges","archive_url":"https://api.github.com/repos/rackerlabs/deuce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackerlabs/deuce/downloads","issues_url":"https://api.github.com/repos/rackerlabs/deuce/issues{/number}","pulls_url":"https://api.github.com/repos/rackerlabs/deuce/pulls{/number}","milestones_url":"https://api.github.com/repos/rackerlabs/deuce/milestones{/number}","notifications_url":"https://api.github.com/repos/rackerlabs/deuce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackerlabs/deuce/labels{/name}","releases_url":"https://api.github.com/repos/rackerlabs/deuce/releases{/id}","created_at":"2014-01-23T15:10:52Z","updated_at":"2014-09-02T15:29:06Z","pushed_at":"2014-09-02T15:29:06Z","git_url":"git://github.com/rackerlabs/deuce.git","ssh_url":"git@github.com:rackerlabs/deuce.git","clone_url":"https://github.com/rackerlabs/deuce.git","svn_url":"https://github.com/rackerlabs/deuce","homepage":null,"size":3781,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":7,"mirror_url":null,"open_issues_count":5,"forks":7,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/deuce/pulls/119"},"html":{"href":"https://github.com/rackerlabs/deuce/pull/119"},"issue":{"href":"https://api.github.com/repos/rackerlabs/deuce/issues/119"},"comments":{"href":"https://api.github.com/repos/rackerlabs/deuce/issues/119/comments"},"review_comments":{"href":"https://api.github.com/repos/rackerlabs/deuce/pulls/119/comments"},"review_comment":{"href":"https://api.github.com/repos/rackerlabs/deuce/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rackerlabs/deuce/pulls/119/commits"},"statuses":{"href":"https://api.github.com/repos/rackerlabs/deuce/statuses/b748474d3105cfd7127e3f5650e783620f5000f3"}}}}