{"action":"created","comment":{"url":"https://api.github.com/repos/scality/scality-manila-utils/pulls/comments/34151577","id":34151577,"diff_hunk":"@@ -0,0 +1,146 @@\n+# Copyright (c) 2015 Scality\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\n+# implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+import io\n+import os\n+import os.path\n+import signal\n+\n+from scality_manila_utils import utils\n+from scality_manila_utils.export import ExportTable\n+from scality_manila_utils.exceptions import (EnvironmentException,\n+                                             ExportException)\n+\n+\n+class Helper(object):\n+    \"\"\"\n+    Handles addition, removal of exports as well as client permissions.\n+    \"\"\"\n+\n+    def __init__(self, root_volume, exports_path):\n+        \"\"\"\n+        Create a new Helper instance operating on the given exports file.\n+\n+        :param root_volume: root volume exported by the sfused nfs connector\n+        :type root_volume: string (unicode)\n+        :param exports_path: path to nfs exports file\n+        :type exports_path: string (unicode)\n+        \"\"\"\n+        # Ring root volume export\n+        self.root_volume = root_volume\n+\n+        if not os.path.exists(exports_path):\n+            raise EnvironmentException('Unable to locate exports file')\n+\n+        # Path to nfs exports file\n+        self.exports_path = exports_path\n+\n+        with io.open(self.exports_path, 'rt') as exports_file:\n+            lines = (line for line in exports_file)","path":"scality_manila_utils/helper.py","position":51,"original_position":51,"commit_id":"df169baace11aaa57f16dbb4de61e752f4cb1238","original_commit_id":"df169baace11aaa57f16dbb4de61e752f4cb1238","user":{"login":"NicolasT","id":102605,"avatar_url":"https://avatars.githubusercontent.com/u/102605?v=3","gravatar_id":"","url":"https://api.github.com/users/NicolasT","html_url":"https://github.com/NicolasT","followers_url":"https://api.github.com/users/NicolasT/followers","following_url":"https://api.github.com/users/NicolasT/following{/other_user}","gists_url":"https://api.github.com/users/NicolasT/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolasT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolasT/subscriptions","organizations_url":"https://api.github.com/users/NicolasT/orgs","repos_url":"https://api.github.com/users/NicolasT/repos","events_url":"https://api.github.com/users/NicolasT/events{/privacy}","received_events_url":"https://api.github.com/users/NicolasT/received_events","type":"User","site_admin":false},"body":"So, `lines` = `exports_file` from a behaviour PoV? Then I guess `exports_file` can be passed to `ExportTable.deserialize` as-is :-)","created_at":"2015-07-08T14:14:57Z","updated_at":"2015-07-08T14:14:57Z","html_url":"https://github.com/scality/scality-manila-utils/pull/2#discussion_r34151577","pull_request_url":"https://api.github.com/repos/scality/scality-manila-utils/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/scality/scality-manila-utils/pulls/comments/34151577"},"html":{"href":"https://github.com/scality/scality-manila-utils/pull/2#discussion_r34151577"},"pull_request":{"href":"https://api.github.com/repos/scality/scality-manila-utils/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/scality/scality-manila-utils/pulls/2","id":38336881,"html_url":"https://github.com/scality/scality-manila-utils/pull/2","diff_url":"https://github.com/scality/scality-manila-utils/pull/2.diff","patch_url":"https://github.com/scality/scality-manila-utils/pull/2.patch","issue_url":"https://api.github.com/repos/scality/scality-manila-utils/issues/2","number":2,"state":"open","locked":false,"title":"First cli iteration","user":{"login":"sbjorn","id":3911596,"avatar_url":"https://avatars.githubusercontent.com/u/3911596?v=3","gravatar_id":"","url":"https://api.github.com/users/sbjorn","html_url":"https://github.com/sbjorn","followers_url":"https://api.github.com/users/sbjorn/followers","following_url":"https://api.github.com/users/sbjorn/following{/other_user}","gists_url":"https://api.github.com/users/sbjorn/gists{/gist_id}","starred_url":"https://api.github.com/users/sbjorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbjorn/subscriptions","organizations_url":"https://api.github.com/users/sbjorn/orgs","repos_url":"https://api.github.com/users/sbjorn/repos","events_url":"https://api.github.com/users/sbjorn/events{/privacy}","received_events_url":"https://api.github.com/users/sbjorn/received_events","type":"User","site_admin":false},"body":"This is an implementation of the cli which will allow the Manila driver to manage nfs exports residing on the ring.\r\n\r\nThe base assumption is that this cli exists on a machine that can be accessible by openstack tenants, and the manila admin network, and has the nfs connector configured for access to an already installed and configured ring.\r\n\r\nWhen access to an export for a client is granted or revoked, the exports file is modified accordingly and reexported by HUPing the sfused process.","created_at":"2015-06-23T13:35:49Z","updated_at":"2015-07-08T14:14:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f3054a5790218f26192534b46e97bef16379649f","assignee":{"login":"NicolasT","id":102605,"avatar_url":"https://avatars.githubusercontent.com/u/102605?v=3","gravatar_id":"","url":"https://api.github.com/users/NicolasT","html_url":"https://github.com/NicolasT","followers_url":"https://api.github.com/users/NicolasT/followers","following_url":"https://api.github.com/users/NicolasT/following{/other_user}","gists_url":"https://api.github.com/users/NicolasT/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolasT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolasT/subscriptions","organizations_url":"https://api.github.com/users/NicolasT/orgs","repos_url":"https://api.github.com/users/NicolasT/repos","events_url":"https://api.github.com/users/NicolasT/events{/privacy}","received_events_url":"https://api.github.com/users/NicolasT/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/scality/scality-manila-utils/pulls/2/commits","review_comments_url":"https://api.github.com/repos/scality/scality-manila-utils/pulls/2/comments","review_comment_url":"https://api.github.com/repos/scality/scality-manila-utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scality/scality-manila-utils/issues/2/comments","statuses_url":"https://api.github.com/repos/scality/scality-manila-utils/statuses/df169baace11aaa57f16dbb4de61e752f4cb1238","head":{"label":"scality:develop","ref":"develop","sha":"df169baace11aaa57f16dbb4de61e752f4cb1238","user":{"login":"scality","id":383812,"avatar_url":"https://avatars.githubusercontent.com/u/383812?v=3","gravatar_id":"","url":"https://api.github.com/users/scality","html_url":"https://github.com/scality","followers_url":"https://api.github.com/users/scality/followers","following_url":"https://api.github.com/users/scality/following{/other_user}","gists_url":"https://api.github.com/users/scality/gists{/gist_id}","starred_url":"https://api.github.com/users/scality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scality/subscriptions","organizations_url":"https://api.github.com/users/scality/orgs","repos_url":"https://api.github.com/users/scality/repos","events_url":"https://api.github.com/users/scality/events{/privacy}","received_events_url":"https://api.github.com/users/scality/received_events","type":"Organization","site_admin":false},"repo":{"id":37521601,"name":"scality-manila-utils","full_name":"scality/scality-manila-utils","owner":{"login":"scality","id":383812,"avatar_url":"https://avatars.githubusercontent.com/u/383812?v=3","gravatar_id":"","url":"https://api.github.com/users/scality","html_url":"https://github.com/scality","followers_url":"https://api.github.com/users/scality/followers","following_url":"https://api.github.com/users/scality/following{/other_user}","gists_url":"https://api.github.com/users/scality/gists{/gist_id}","starred_url":"https://api.github.com/users/scality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scality/subscriptions","organizations_url":"https://api.github.com/users/scality/orgs","repos_url":"https://api.github.com/users/scality/repos","events_url":"https://api.github.com/users/scality/events{/privacy}","received_events_url":"https://api.github.com/users/scality/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scality/scality-manila-utils","description":"Utilities package for the Scality OpenStack Manila driver","fork":false,"url":"https://api.github.com/repos/scality/scality-manila-utils","forks_url":"https://api.github.com/repos/scality/scality-manila-utils/forks","keys_url":"https://api.github.com/repos/scality/scality-manila-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scality/scality-manila-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scality/scality-manila-utils/teams","hooks_url":"https://api.github.com/repos/scality/scality-manila-utils/hooks","issue_events_url":"https://api.github.com/repos/scality/scality-manila-utils/issues/events{/number}","events_url":"https://api.github.com/repos/scality/scality-manila-utils/events","assignees_url":"https://api.github.com/repos/scality/scality-manila-utils/assignees{/user}","branches_url":"https://api.github.com/repos/scality/scality-manila-utils/branches{/branch}","tags_url":"https://api.github.com/repos/scality/scality-manila-utils/tags","blobs_url":"https://api.github.com/repos/scality/scality-manila-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scality/scality-manila-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scality/scality-manila-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/scality/scality-manila-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scality/scality-manila-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/scality/scality-manila-utils/languages","stargazers_url":"https://api.github.com/repos/scality/scality-manila-utils/stargazers","contributors_url":"https://api.github.com/repos/scality/scality-manila-utils/contributors","subscribers_url":"https://api.github.com/repos/scality/scality-manila-utils/subscribers","subscription_url":"https://api.github.com/repos/scality/scality-manila-utils/subscription","commits_url":"https://api.github.com/repos/scality/scality-manila-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/scality/scality-manila-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/scality/scality-manila-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/scality/scality-manila-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/scality/scality-manila-utils/contents/{+path}","compare_url":"https://api.github.com/repos/scality/scality-manila-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scality/scality-manila-utils/merges","archive_url":"https://api.github.com/repos/scality/scality-manila-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scality/scality-manila-utils/downloads","issues_url":"https://api.github.com/repos/scality/scality-manila-utils/issues{/number}","pulls_url":"https://api.github.com/repos/scality/scality-manila-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/scality/scality-manila-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/scality/scality-manila-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scality/scality-manila-utils/labels{/name}","releases_url":"https://api.github.com/repos/scality/scality-manila-utils/releases{/id}","created_at":"2015-06-16T09:43:25Z","updated_at":"2015-06-22T15:22:36Z","pushed_at":"2015-07-03T13:28:58Z","git_url":"git://github.com/scality/scality-manila-utils.git","ssh_url":"git@github.com:scality/scality-manila-utils.git","clone_url":"https://github.com/scality/scality-manila-utils.git","svn_url":"https://github.com/scality/scality-manila-utils","homepage":null,"size":260,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"scality:master","ref":"master","sha":"9d9809c01f29ee90ac13bd44609f775cecf63d6f","user":{"login":"scality","id":383812,"avatar_url":"https://avatars.githubusercontent.com/u/383812?v=3","gravatar_id":"","url":"https://api.github.com/users/scality","html_url":"https://github.com/scality","followers_url":"https://api.github.com/users/scality/followers","following_url":"https://api.github.com/users/scality/following{/other_user}","gists_url":"https://api.github.com/users/scality/gists{/gist_id}","starred_url":"https://api.github.com/users/scality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scality/subscriptions","organizations_url":"https://api.github.com/users/scality/orgs","repos_url":"https://api.github.com/users/scality/repos","events_url":"https://api.github.com/users/scality/events{/privacy}","received_events_url":"https://api.github.com/users/scality/received_events","type":"Organization","site_admin":false},"repo":{"id":37521601,"name":"scality-manila-utils","full_name":"scality/scality-manila-utils","owner":{"login":"scality","id":383812,"avatar_url":"https://avatars.githubusercontent.com/u/383812?v=3","gravatar_id":"","url":"https://api.github.com/users/scality","html_url":"https://github.com/scality","followers_url":"https://api.github.com/users/scality/followers","following_url":"https://api.github.com/users/scality/following{/other_user}","gists_url":"https://api.github.com/users/scality/gists{/gist_id}","starred_url":"https://api.github.com/users/scality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scality/subscriptions","organizations_url":"https://api.github.com/users/scality/orgs","repos_url":"https://api.github.com/users/scality/repos","events_url":"https://api.github.com/users/scality/events{/privacy}","received_events_url":"https://api.github.com/users/scality/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scality/scality-manila-utils","description":"Utilities package for the Scality OpenStack Manila driver","fork":false,"url":"https://api.github.com/repos/scality/scality-manila-utils","forks_url":"https://api.github.com/repos/scality/scality-manila-utils/forks","keys_url":"https://api.github.com/repos/scality/scality-manila-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scality/scality-manila-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scality/scality-manila-utils/teams","hooks_url":"https://api.github.com/repos/scality/scality-manila-utils/hooks","issue_events_url":"https://api.github.com/repos/scality/scality-manila-utils/issues/events{/number}","events_url":"https://api.github.com/repos/scality/scality-manila-utils/events","assignees_url":"https://api.github.com/repos/scality/scality-manila-utils/assignees{/user}","branches_url":"https://api.github.com/repos/scality/scality-manila-utils/branches{/branch}","tags_url":"https://api.github.com/repos/scality/scality-manila-utils/tags","blobs_url":"https://api.github.com/repos/scality/scality-manila-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scality/scality-manila-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scality/scality-manila-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/scality/scality-manila-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scality/scality-manila-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/scality/scality-manila-utils/languages","stargazers_url":"https://api.github.com/repos/scality/scality-manila-utils/stargazers","contributors_url":"https://api.github.com/repos/scality/scality-manila-utils/contributors","subscribers_url":"https://api.github.com/repos/scality/scality-manila-utils/subscribers","subscription_url":"https://api.github.com/repos/scality/scality-manila-utils/subscription","commits_url":"https://api.github.com/repos/scality/scality-manila-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/scality/scality-manila-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/scality/scality-manila-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/scality/scality-manila-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/scality/scality-manila-utils/contents/{+path}","compare_url":"https://api.github.com/repos/scality/scality-manila-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scality/scality-manila-utils/merges","archive_url":"https://api.github.com/repos/scality/scality-manila-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scality/scality-manila-utils/downloads","issues_url":"https://api.github.com/repos/scality/scality-manila-utils/issues{/number}","pulls_url":"https://api.github.com/repos/scality/scality-manila-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/scality/scality-manila-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/scality/scality-manila-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scality/scality-manila-utils/labels{/name}","releases_url":"https://api.github.com/repos/scality/scality-manila-utils/releases{/id}","created_at":"2015-06-16T09:43:25Z","updated_at":"2015-06-22T15:22:36Z","pushed_at":"2015-07-03T13:28:58Z","git_url":"git://github.com/scality/scality-manila-utils.git","ssh_url":"git@github.com:scality/scality-manila-utils.git","clone_url":"https://github.com/scality/scality-manila-utils.git","svn_url":"https://github.com/scality/scality-manila-utils","homepage":null,"size":260,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scality/scality-manila-utils/pulls/2"},"html":{"href":"https://github.com/scality/scality-manila-utils/pull/2"},"issue":{"href":"https://api.github.com/repos/scality/scality-manila-utils/issues/2"},"comments":{"href":"https://api.github.com/repos/scality/scality-manila-utils/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/scality/scality-manila-utils/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/scality/scality-manila-utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scality/scality-manila-utils/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/scality/scality-manila-utils/statuses/df169baace11aaa57f16dbb4de61e752f4cb1238"}}}}