{"action":"created","comment":{"url":"https://api.github.com/repos/juju/python-libjuju/pulls/comments/157197598","pull_request_review_id":83804526,"id":157197598,"diff_hunk":"@@ -33,11 +33,28 @@ def __init__(self, loop=None, max_frame_size=None, bakery_client=None):\n     def loop(self):\n         return self._connector.loop\n \n-    async def connect(self, controller_name=None):\n-        \"\"\"Connect to a Juju controller by name. If controller_name\n-        is empty, connect to the current controller.\n+    async def connect(self, controller_name=None, **kwargs):\n+        \"\"\"Connect to a Juju controller.\n+\n+        If any arguments are specified other than model_name,\n+        then controller_name must be None and an explicit\n+        connection will be made using Connection.connect\n+        using those parameters (the 'uuid' parameter must\n+        be absent or None).\n+\n+        Otherwise, if controller_name is None, connect to the\n+        current controller.\n+\n+        Otherwise, controller_name must specify the name\n+        of a known controller.\n         \"\"\"\n-        await self._connector.connect_controller(controller_name)\n+        await self.disconnect()\n+        if len(kwargs) == 0:\n+            await self._connector.connect_controller(controller_name)","path":"juju/controller.py","position":25,"original_position":25,"commit_id":"ba3eb76ca03c8ac694e6ee59f756935ac354e3b4","original_commit_id":"ba3eb76ca03c8ac694e6ee59f756935ac354e3b4","user":{"login":"rogpeppe","id":66491,"avatar_url":"https://avatars0.githubusercontent.com/u/66491?v=4","gravatar_id":"","url":"https://api.github.com/users/rogpeppe","html_url":"https://github.com/rogpeppe","followers_url":"https://api.github.com/users/rogpeppe/followers","following_url":"https://api.github.com/users/rogpeppe/following{/other_user}","gists_url":"https://api.github.com/users/rogpeppe/gists{/gist_id}","starred_url":"https://api.github.com/users/rogpeppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogpeppe/subscriptions","organizations_url":"https://api.github.com/users/rogpeppe/orgs","repos_url":"https://api.github.com/users/rogpeppe/repos","events_url":"https://api.github.com/users/rogpeppe/events{/privacy}","received_events_url":"https://api.github.com/users/rogpeppe/received_events","type":"User","site_admin":false},"body":"I don't understand this comment. Each call to _connector.connect is a separate arm of the if statement. I don't see how both could happen.","created_at":"2017-12-15T13:15:04Z","updated_at":"2017-12-15T13:15:04Z","html_url":"https://github.com/juju/python-libjuju/pull/196#discussion_r157197598","pull_request_url":"https://api.github.com/repos/juju/python-libjuju/pulls/196","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/juju/python-libjuju/pulls/comments/157197598"},"html":{"href":"https://github.com/juju/python-libjuju/pull/196#discussion_r157197598"},"pull_request":{"href":"https://api.github.com/repos/juju/python-libjuju/pulls/196"}},"in_reply_to_id":157195955},"pull_request":{"url":"https://api.github.com/repos/juju/python-libjuju/pulls/196","id":158407511,"html_url":"https://github.com/juju/python-libjuju/pull/196","diff_url":"https://github.com/juju/python-libjuju/pull/196.diff","patch_url":"https://github.com/juju/python-libjuju/pull/196.patch","issue_url":"https://api.github.com/repos/juju/python-libjuju/issues/196","number":196,"state":"open","locked":false,"title":"Make Model and Controller connect methods backwardly compatible","user":{"login":"rogpeppe","id":66491,"avatar_url":"https://avatars0.githubusercontent.com/u/66491?v=4","gravatar_id":"","url":"https://api.github.com/users/rogpeppe","html_url":"https://github.com/rogpeppe","followers_url":"https://api.github.com/users/rogpeppe/followers","following_url":"https://api.github.com/users/rogpeppe/following{/other_user}","gists_url":"https://api.github.com/users/rogpeppe/gists{/gist_id}","starred_url":"https://api.github.com/users/rogpeppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogpeppe/subscriptions","organizations_url":"https://api.github.com/users/rogpeppe/orgs","repos_url":"https://api.github.com/users/rogpeppe/repos","events_url":"https://api.github.com/users/rogpeppe/events{/privacy}","received_events_url":"https://api.github.com/users/rogpeppe/received_events","type":"User","site_admin":false},"body":"API users are using connect to directly connect using known parameters.\r\nMake Model.connect and Controller.connect into a do-it-all methods\r\nthat can connect using directly specified endpoints etc as well\r\nas by specifying a model or controller name.\r\n\r\nFixes #195.","created_at":"2017-12-14T16:46:18Z","updated_at":"2017-12-15T13:15:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f841073494c5d3e237b18d0b55f5defa3378ec5c","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/juju/python-libjuju/pulls/196/commits","review_comments_url":"https://api.github.com/repos/juju/python-libjuju/pulls/196/comments","review_comment_url":"https://api.github.com/repos/juju/python-libjuju/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juju/python-libjuju/issues/196/comments","statuses_url":"https://api.github.com/repos/juju/python-libjuju/statuses/ba3eb76ca03c8ac694e6ee59f756935ac354e3b4","head":{"label":"rogpeppe:010-backwardly-compatible-connect","ref":"010-backwardly-compatible-connect","sha":"ba3eb76ca03c8ac694e6ee59f756935ac354e3b4","user":{"login":"rogpeppe","id":66491,"avatar_url":"https://avatars0.githubusercontent.com/u/66491?v=4","gravatar_id":"","url":"https://api.github.com/users/rogpeppe","html_url":"https://github.com/rogpeppe","followers_url":"https://api.github.com/users/rogpeppe/followers","following_url":"https://api.github.com/users/rogpeppe/following{/other_user}","gists_url":"https://api.github.com/users/rogpeppe/gists{/gist_id}","starred_url":"https://api.github.com/users/rogpeppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogpeppe/subscriptions","organizations_url":"https://api.github.com/users/rogpeppe/orgs","repos_url":"https://api.github.com/users/rogpeppe/repos","events_url":"https://api.github.com/users/rogpeppe/events{/privacy}","received_events_url":"https://api.github.com/users/rogpeppe/received_events","type":"User","site_admin":false},"repo":{"id":110549399,"name":"python-libjuju","full_name":"rogpeppe/python-libjuju","owner":{"login":"rogpeppe","id":66491,"avatar_url":"https://avatars0.githubusercontent.com/u/66491?v=4","gravatar_id":"","url":"https://api.github.com/users/rogpeppe","html_url":"https://github.com/rogpeppe","followers_url":"https://api.github.com/users/rogpeppe/followers","following_url":"https://api.github.com/users/rogpeppe/following{/other_user}","gists_url":"https://api.github.com/users/rogpeppe/gists{/gist_id}","starred_url":"https://api.github.com/users/rogpeppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogpeppe/subscriptions","organizations_url":"https://api.github.com/users/rogpeppe/orgs","repos_url":"https://api.github.com/users/rogpeppe/repos","events_url":"https://api.github.com/users/rogpeppe/events{/privacy}","received_events_url":"https://api.github.com/users/rogpeppe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rogpeppe/python-libjuju","description":null,"fork":true,"url":"https://api.github.com/repos/rogpeppe/python-libjuju","forks_url":"https://api.github.com/repos/rogpeppe/python-libjuju/forks","keys_url":"https://api.github.com/repos/rogpeppe/python-libjuju/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rogpeppe/python-libjuju/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rogpeppe/python-libjuju/teams","hooks_url":"https://api.github.com/repos/rogpeppe/python-libjuju/hooks","issue_events_url":"https://api.github.com/repos/rogpeppe/python-libjuju/issues/events{/number}","events_url":"https://api.github.com/repos/rogpeppe/python-libjuju/events","assignees_url":"https://api.github.com/repos/rogpeppe/python-libjuju/assignees{/user}","branches_url":"https://api.github.com/repos/rogpeppe/python-libjuju/branches{/branch}","tags_url":"https://api.github.com/repos/rogpeppe/python-libjuju/tags","blobs_url":"https://api.github.com/repos/rogpeppe/python-libjuju/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rogpeppe/python-libjuju/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rogpeppe/python-libjuju/git/refs{/sha}","trees_url":"https://api.github.com/repos/rogpeppe/python-libjuju/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rogpeppe/python-libjuju/statuses/{sha}","languages_url":"https://api.github.com/repos/rogpeppe/python-libjuju/languages","stargazers_url":"https://api.github.com/repos/rogpeppe/python-libjuju/stargazers","contributors_url":"https://api.github.com/repos/rogpeppe/python-libjuju/contributors","subscribers_url":"https://api.github.com/repos/rogpeppe/python-libjuju/subscribers","subscription_url":"https://api.github.com/repos/rogpeppe/python-libjuju/subscription","commits_url":"https://api.github.com/repos/rogpeppe/python-libjuju/commits{/sha}","git_commits_url":"https://api.github.com/repos/rogpeppe/python-libjuju/git/commits{/sha}","comments_url":"https://api.github.com/repos/rogpeppe/python-libjuju/comments{/number}","issue_comment_url":"https://api.github.com/repos/rogpeppe/python-libjuju/issues/comments{/number}","contents_url":"https://api.github.com/repos/rogpeppe/python-libjuju/contents/{+path}","compare_url":"https://api.github.com/repos/rogpeppe/python-libjuju/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rogpeppe/python-libjuju/merges","archive_url":"https://api.github.com/repos/rogpeppe/python-libjuju/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rogpeppe/python-libjuju/downloads","issues_url":"https://api.github.com/repos/rogpeppe/python-libjuju/issues{/number}","pulls_url":"https://api.github.com/repos/rogpeppe/python-libjuju/pulls{/number}","milestones_url":"https://api.github.com/repos/rogpeppe/python-libjuju/milestones{/number}","notifications_url":"https://api.github.com/repos/rogpeppe/python-libjuju/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rogpeppe/python-libjuju/labels{/name}","releases_url":"https://api.github.com/repos/rogpeppe/python-libjuju/releases{/id}","deployments_url":"https://api.github.com/repos/rogpeppe/python-libjuju/deployments","created_at":"2017-11-13T13:07:01Z","updated_at":"2017-11-13T13:07:03Z","pushed_at":"2017-12-15T12:33:08Z","git_url":"git://github.com/rogpeppe/python-libjuju.git","ssh_url":"git@github.com:rogpeppe/python-libjuju.git","clone_url":"https://github.com/rogpeppe/python-libjuju.git","svn_url":"https://github.com/rogpeppe/python-libjuju","homepage":null,"size":1321,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"juju:master","ref":"master","sha":"19b565817ce20dcc762b3e149b4a0c960acc68dc","user":{"login":"juju","id":4604548,"avatar_url":"https://avatars0.githubusercontent.com/u/4604548?v=4","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"repo":{"id":58479957,"name":"python-libjuju","full_name":"juju/python-libjuju","owner":{"login":"juju","id":4604548,"avatar_url":"https://avatars0.githubusercontent.com/u/4604548?v=4","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juju/python-libjuju","description":null,"fork":false,"url":"https://api.github.com/repos/juju/python-libjuju","forks_url":"https://api.github.com/repos/juju/python-libjuju/forks","keys_url":"https://api.github.com/repos/juju/python-libjuju/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juju/python-libjuju/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juju/python-libjuju/teams","hooks_url":"https://api.github.com/repos/juju/python-libjuju/hooks","issue_events_url":"https://api.github.com/repos/juju/python-libjuju/issues/events{/number}","events_url":"https://api.github.com/repos/juju/python-libjuju/events","assignees_url":"https://api.github.com/repos/juju/python-libjuju/assignees{/user}","branches_url":"https://api.github.com/repos/juju/python-libjuju/branches{/branch}","tags_url":"https://api.github.com/repos/juju/python-libjuju/tags","blobs_url":"https://api.github.com/repos/juju/python-libjuju/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juju/python-libjuju/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juju/python-libjuju/git/refs{/sha}","trees_url":"https://api.github.com/repos/juju/python-libjuju/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juju/python-libjuju/statuses/{sha}","languages_url":"https://api.github.com/repos/juju/python-libjuju/languages","stargazers_url":"https://api.github.com/repos/juju/python-libjuju/stargazers","contributors_url":"https://api.github.com/repos/juju/python-libjuju/contributors","subscribers_url":"https://api.github.com/repos/juju/python-libjuju/subscribers","subscription_url":"https://api.github.com/repos/juju/python-libjuju/subscription","commits_url":"https://api.github.com/repos/juju/python-libjuju/commits{/sha}","git_commits_url":"https://api.github.com/repos/juju/python-libjuju/git/commits{/sha}","comments_url":"https://api.github.com/repos/juju/python-libjuju/comments{/number}","issue_comment_url":"https://api.github.com/repos/juju/python-libjuju/issues/comments{/number}","contents_url":"https://api.github.com/repos/juju/python-libjuju/contents/{+path}","compare_url":"https://api.github.com/repos/juju/python-libjuju/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juju/python-libjuju/merges","archive_url":"https://api.github.com/repos/juju/python-libjuju/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juju/python-libjuju/downloads","issues_url":"https://api.github.com/repos/juju/python-libjuju/issues{/number}","pulls_url":"https://api.github.com/repos/juju/python-libjuju/pulls{/number}","milestones_url":"https://api.github.com/repos/juju/python-libjuju/milestones{/number}","notifications_url":"https://api.github.com/repos/juju/python-libjuju/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juju/python-libjuju/labels{/name}","releases_url":"https://api.github.com/repos/juju/python-libjuju/releases{/id}","deployments_url":"https://api.github.com/repos/juju/python-libjuju/deployments","created_at":"2016-05-10T17:15:09Z","updated_at":"2017-10-12T18:34:28Z","pushed_at":"2017-12-15T12:33:09Z","git_url":"git://github.com/juju/python-libjuju.git","ssh_url":"git@github.com:juju/python-libjuju.git","clone_url":"https://github.com/juju/python-libjuju.git","svn_url":"https://github.com/juju/python-libjuju","homepage":null,"size":1217,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":41,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":17,"open_issues":41,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/juju/python-libjuju/pulls/196"},"html":{"href":"https://github.com/juju/python-libjuju/pull/196"},"issue":{"href":"https://api.github.com/repos/juju/python-libjuju/issues/196"},"comments":{"href":"https://api.github.com/repos/juju/python-libjuju/issues/196/comments"},"review_comments":{"href":"https://api.github.com/repos/juju/python-libjuju/pulls/196/comments"},"review_comment":{"href":"https://api.github.com/repos/juju/python-libjuju/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juju/python-libjuju/pulls/196/commits"},"statuses":{"href":"https://api.github.com/repos/juju/python-libjuju/statuses/ba3eb76ca03c8ac694e6ee59f756935ac354e3b4"}},"author_association":"OWNER"}}
{"actor":{"display_login":"rogpeppe"}}