{"action":"created","comment":{"url":"https://api.github.com/repos/candlepin/subscription-manager/pulls/comments/33356012","id":33356012,"diff_hunk":"@@ -0,0 +1,83 @@\n+#\n+# Copyright (c) 2015 Red Hat, Inc.\n+#\n+# This software is licensed to you under the GNU General Public\n+# License as published by the Free Software Foundation; either version\n+# 2 of the License (GPLv2) or (at your option) any later version.\n+# There is NO WARRANTY for this software, express or implied,\n+# including the implied warranties of MERCHANTABILITY,\n+# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should\n+# have received a copy of GPLv2 along with this software; if not, see\n+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.\n+#\n+\n+\"\"\"\n+Class and methods in this module are provided for use by external applications with\n+the exception of methods beginning with an '_'.\n+\n+All reasonable efforts will be made to maintain compatibility.\n+\"\"\"\n+import fnmatch\n+\n+from subscription_manager import logutil\n+logutil.init_logger()","path":"src/subscription_manager/api.py","position":23,"original_position":23,"commit_id":"842c895fad68f7d85b07c808dccc7fcd1c94b7f7","original_commit_id":"842c895fad68f7d85b07c808dccc7fcd1c94b7f7","user":{"login":"alikins","id":15162,"avatar_url":"https://avatars.githubusercontent.com/u/15162?v=3","gravatar_id":"","url":"https://api.github.com/users/alikins","html_url":"https://github.com/alikins","followers_url":"https://api.github.com/users/alikins/followers","following_url":"https://api.github.com/users/alikins/following{/other_user}","gists_url":"https://api.github.com/users/alikins/gists{/gist_id}","starred_url":"https://api.github.com/users/alikins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alikins/subscriptions","organizations_url":"https://api.github.com/users/alikins/orgs","repos_url":"https://api.github.com/users/alikins/repos","events_url":"https://api.github.com/users/alikins/events{/privacy}","received_events_url":"https://api.github.com/users/alikins/received_events","type":"User","site_admin":false},"body":"Could this init/setup stuff move into a method instead of module scope?\r\n\r\nIf our yum plugins (plugins/subscription-manager.py for ex) import 'api', they would do some of this twice.","created_at":"2015-06-26T13:38:30Z","updated_at":"2015-06-26T13:38:30Z","html_url":"https://github.com/candlepin/subscription-manager/pull/1211#discussion_r33356012","pull_request_url":"https://api.github.com/repos/candlepin/subscription-manager/pulls/1211","_links":{"self":{"href":"https://api.github.com/repos/candlepin/subscription-manager/pulls/comments/33356012"},"html":{"href":"https://github.com/candlepin/subscription-manager/pull/1211#discussion_r33356012"},"pull_request":{"href":"https://api.github.com/repos/candlepin/subscription-manager/pulls/1211"}}},"pull_request":{"url":"https://api.github.com/repos/candlepin/subscription-manager/pulls/1211","id":38475957,"html_url":"https://github.com/candlepin/subscription-manager/pull/1211","diff_url":"https://github.com/candlepin/subscription-manager/pull/1211.diff","patch_url":"https://github.com/candlepin/subscription-manager/pull/1211.patch","issue_url":"https://api.github.com/repos/candlepin/subscription-manager/issues/1211","number":1211,"state":"open","locked":false,"title":"1232232: Add supported API to enable content repositories.","user":{"login":"awood","id":17975,"avatar_url":"https://avatars.githubusercontent.com/u/17975?v=3","gravatar_id":"","url":"https://api.github.com/users/awood","html_url":"https://github.com/awood","followers_url":"https://api.github.com/users/awood/followers","following_url":"https://api.github.com/users/awood/following{/other_user}","gists_url":"https://api.github.com/users/awood/gists{/gist_id}","starred_url":"https://api.github.com/users/awood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awood/subscriptions","organizations_url":"https://api.github.com/users/awood/orgs","repos_url":"https://api.github.com/users/awood/repos","events_url":"https://api.github.com/users/awood/events{/privacy}","received_events_url":"https://api.github.com/users/awood/received_events","type":"User","site_admin":false},"body":"How to test:\r\n\r\n1. Attach to some valid subscriptions so that you have something present in `redhat.repo`\r\n1. `cp /etc/yum.repos.d/redhat.repo /tmp/redhat.bak`\r\n1. Take a look at `redhat.repo` and find some disabled repos\r\n1. Run `PYTHONPATH=src/ python`\r\n1. In the REPL, do the following.  (The argument passed to `enable_repositories` should be the ID for one of the repos you picked in step 3)\r\n\r\n    ```\r\n    >>> from subscription_manager import api\r\n    >>> api.enable_repositories('rhs-big-data*')\r\n    ```\r\n1. The result should be non-zero\r\n1. Quit the REPL with Ctrl-D\r\n1. `diff -u /tmp/redhat.bak /etc/yum.repos.d/redhat.repo`\r\n1. The only differences should be the newly enabled repositories. Additionally, `/var/log/rhsm/rhsm.log` should have messages generated when a repositories is enabled.","created_at":"2015-06-24T19:05:04Z","updated_at":"2015-06-26T13:38:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"17446a6c5d91ce052fafb80971d458689207f5d3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/candlepin/subscription-manager/pulls/1211/commits","review_comments_url":"https://api.github.com/repos/candlepin/subscription-manager/pulls/1211/comments","review_comment_url":"https://api.github.com/repos/candlepin/subscription-manager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/candlepin/subscription-manager/issues/1211/comments","statuses_url":"https://api.github.com/repos/candlepin/subscription-manager/statuses/842c895fad68f7d85b07c808dccc7fcd1c94b7f7","head":{"label":"candlepin:awood/1232232-enable-repos","ref":"awood/1232232-enable-repos","sha":"842c895fad68f7d85b07c808dccc7fcd1c94b7f7","user":{"login":"candlepin","id":1749632,"avatar_url":"https://avatars.githubusercontent.com/u/1749632?v=3","gravatar_id":"","url":"https://api.github.com/users/candlepin","html_url":"https://github.com/candlepin","followers_url":"https://api.github.com/users/candlepin/followers","following_url":"https://api.github.com/users/candlepin/following{/other_user}","gists_url":"https://api.github.com/users/candlepin/gists{/gist_id}","starred_url":"https://api.github.com/users/candlepin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candlepin/subscriptions","organizations_url":"https://api.github.com/users/candlepin/orgs","repos_url":"https://api.github.com/users/candlepin/repos","events_url":"https://api.github.com/users/candlepin/events{/privacy}","received_events_url":"https://api.github.com/users/candlepin/received_events","type":"Organization","site_admin":false},"repo":{"id":4360334,"name":"subscription-manager","full_name":"candlepin/subscription-manager","owner":{"login":"candlepin","id":1749632,"avatar_url":"https://avatars.githubusercontent.com/u/1749632?v=3","gravatar_id":"","url":"https://api.github.com/users/candlepin","html_url":"https://github.com/candlepin","followers_url":"https://api.github.com/users/candlepin/followers","following_url":"https://api.github.com/users/candlepin/following{/other_user}","gists_url":"https://api.github.com/users/candlepin/gists{/gist_id}","starred_url":"https://api.github.com/users/candlepin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candlepin/subscriptions","organizations_url":"https://api.github.com/users/candlepin/orgs","repos_url":"https://api.github.com/users/candlepin/repos","events_url":"https://api.github.com/users/candlepin/events{/privacy}","received_events_url":"https://api.github.com/users/candlepin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/candlepin/subscription-manager","description":"A GUI and CLI client for Candlepin","fork":false,"url":"https://api.github.com/repos/candlepin/subscription-manager","forks_url":"https://api.github.com/repos/candlepin/subscription-manager/forks","keys_url":"https://api.github.com/repos/candlepin/subscription-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/candlepin/subscription-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/candlepin/subscription-manager/teams","hooks_url":"https://api.github.com/repos/candlepin/subscription-manager/hooks","issue_events_url":"https://api.github.com/repos/candlepin/subscription-manager/issues/events{/number}","events_url":"https://api.github.com/repos/candlepin/subscription-manager/events","assignees_url":"https://api.github.com/repos/candlepin/subscription-manager/assignees{/user}","branches_url":"https://api.github.com/repos/candlepin/subscription-manager/branches{/branch}","tags_url":"https://api.github.com/repos/candlepin/subscription-manager/tags","blobs_url":"https://api.github.com/repos/candlepin/subscription-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/candlepin/subscription-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/candlepin/subscription-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/candlepin/subscription-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/candlepin/subscription-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/candlepin/subscription-manager/languages","stargazers_url":"https://api.github.com/repos/candlepin/subscription-manager/stargazers","contributors_url":"https://api.github.com/repos/candlepin/subscription-manager/contributors","subscribers_url":"https://api.github.com/repos/candlepin/subscription-manager/subscribers","subscription_url":"https://api.github.com/repos/candlepin/subscription-manager/subscription","commits_url":"https://api.github.com/repos/candlepin/subscription-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/candlepin/subscription-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/candlepin/subscription-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/candlepin/subscription-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/candlepin/subscription-manager/contents/{+path}","compare_url":"https://api.github.com/repos/candlepin/subscription-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/candlepin/subscription-manager/merges","archive_url":"https://api.github.com/repos/candlepin/subscription-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/candlepin/subscription-manager/downloads","issues_url":"https://api.github.com/repos/candlepin/subscription-manager/issues{/number}","pulls_url":"https://api.github.com/repos/candlepin/subscription-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/candlepin/subscription-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/candlepin/subscription-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/candlepin/subscription-manager/labels{/name}","releases_url":"https://api.github.com/repos/candlepin/subscription-manager/releases{/id}","created_at":"2012-05-17T16:13:30Z","updated_at":"2015-05-05T16:00:04Z","pushed_at":"2015-06-25T09:06:33Z","git_url":"git://github.com/candlepin/subscription-manager.git","ssh_url":"git@github.com:candlepin/subscription-manager.git","clone_url":"https://github.com/candlepin/subscription-manager.git","svn_url":"https://github.com/candlepin/subscription-manager","homepage":"http://candlepinproject.org/","size":38519,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":7,"forks":20,"open_issues":7,"watchers":15,"default_branch":"master"}},"base":{"label":"candlepin:master","ref":"master","sha":"8dbe7b4e404f0deae466dfe9161298c0c3278ad9","user":{"login":"candlepin","id":1749632,"avatar_url":"https://avatars.githubusercontent.com/u/1749632?v=3","gravatar_id":"","url":"https://api.github.com/users/candlepin","html_url":"https://github.com/candlepin","followers_url":"https://api.github.com/users/candlepin/followers","following_url":"https://api.github.com/users/candlepin/following{/other_user}","gists_url":"https://api.github.com/users/candlepin/gists{/gist_id}","starred_url":"https://api.github.com/users/candlepin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candlepin/subscriptions","organizations_url":"https://api.github.com/users/candlepin/orgs","repos_url":"https://api.github.com/users/candlepin/repos","events_url":"https://api.github.com/users/candlepin/events{/privacy}","received_events_url":"https://api.github.com/users/candlepin/received_events","type":"Organization","site_admin":false},"repo":{"id":4360334,"name":"subscription-manager","full_name":"candlepin/subscription-manager","owner":{"login":"candlepin","id":1749632,"avatar_url":"https://avatars.githubusercontent.com/u/1749632?v=3","gravatar_id":"","url":"https://api.github.com/users/candlepin","html_url":"https://github.com/candlepin","followers_url":"https://api.github.com/users/candlepin/followers","following_url":"https://api.github.com/users/candlepin/following{/other_user}","gists_url":"https://api.github.com/users/candlepin/gists{/gist_id}","starred_url":"https://api.github.com/users/candlepin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candlepin/subscriptions","organizations_url":"https://api.github.com/users/candlepin/orgs","repos_url":"https://api.github.com/users/candlepin/repos","events_url":"https://api.github.com/users/candlepin/events{/privacy}","received_events_url":"https://api.github.com/users/candlepin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/candlepin/subscription-manager","description":"A GUI and CLI client for Candlepin","fork":false,"url":"https://api.github.com/repos/candlepin/subscription-manager","forks_url":"https://api.github.com/repos/candlepin/subscription-manager/forks","keys_url":"https://api.github.com/repos/candlepin/subscription-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/candlepin/subscription-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/candlepin/subscription-manager/teams","hooks_url":"https://api.github.com/repos/candlepin/subscription-manager/hooks","issue_events_url":"https://api.github.com/repos/candlepin/subscription-manager/issues/events{/number}","events_url":"https://api.github.com/repos/candlepin/subscription-manager/events","assignees_url":"https://api.github.com/repos/candlepin/subscription-manager/assignees{/user}","branches_url":"https://api.github.com/repos/candlepin/subscription-manager/branches{/branch}","tags_url":"https://api.github.com/repos/candlepin/subscription-manager/tags","blobs_url":"https://api.github.com/repos/candlepin/subscription-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/candlepin/subscription-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/candlepin/subscription-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/candlepin/subscription-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/candlepin/subscription-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/candlepin/subscription-manager/languages","stargazers_url":"https://api.github.com/repos/candlepin/subscription-manager/stargazers","contributors_url":"https://api.github.com/repos/candlepin/subscription-manager/contributors","subscribers_url":"https://api.github.com/repos/candlepin/subscription-manager/subscribers","subscription_url":"https://api.github.com/repos/candlepin/subscription-manager/subscription","commits_url":"https://api.github.com/repos/candlepin/subscription-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/candlepin/subscription-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/candlepin/subscription-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/candlepin/subscription-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/candlepin/subscription-manager/contents/{+path}","compare_url":"https://api.github.com/repos/candlepin/subscription-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/candlepin/subscription-manager/merges","archive_url":"https://api.github.com/repos/candlepin/subscription-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/candlepin/subscription-manager/downloads","issues_url":"https://api.github.com/repos/candlepin/subscription-manager/issues{/number}","pulls_url":"https://api.github.com/repos/candlepin/subscription-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/candlepin/subscription-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/candlepin/subscription-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/candlepin/subscription-manager/labels{/name}","releases_url":"https://api.github.com/repos/candlepin/subscription-manager/releases{/id}","created_at":"2012-05-17T16:13:30Z","updated_at":"2015-05-05T16:00:04Z","pushed_at":"2015-06-25T09:06:33Z","git_url":"git://github.com/candlepin/subscription-manager.git","ssh_url":"git@github.com:candlepin/subscription-manager.git","clone_url":"https://github.com/candlepin/subscription-manager.git","svn_url":"https://github.com/candlepin/subscription-manager","homepage":"http://candlepinproject.org/","size":38519,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":7,"forks":20,"open_issues":7,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/candlepin/subscription-manager/pulls/1211"},"html":{"href":"https://github.com/candlepin/subscription-manager/pull/1211"},"issue":{"href":"https://api.github.com/repos/candlepin/subscription-manager/issues/1211"},"comments":{"href":"https://api.github.com/repos/candlepin/subscription-manager/issues/1211/comments"},"review_comments":{"href":"https://api.github.com/repos/candlepin/subscription-manager/pulls/1211/comments"},"review_comment":{"href":"https://api.github.com/repos/candlepin/subscription-manager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/candlepin/subscription-manager/pulls/1211/commits"},"statuses":{"href":"https://api.github.com/repos/candlepin/subscription-manager/statuses/842c895fad68f7d85b07c808dccc7fcd1c94b7f7"}}}}