|
11 | 11 | from juju.client.gocookies import GoCookieJar, go_to_py_cookie |
12 | 12 | from juju.client.jujudata import API_ENDPOINTS_KEY, FileJujuData |
13 | 13 | from juju.client.proxy.factory import proxy_from_config |
14 | | -from juju.errors import (JujuConnectionError, JujuError, |
15 | | - PylibjujuProgrammingError) |
| 14 | +from juju.errors import JujuConnectionError, JujuError |
| 15 | +from juju.client import client |
16 | 16 | from juju.version import SUPPORTED_MAJOR_VERSION, TARGET_JUJU_VERSION |
17 | 17 |
|
18 | 18 | log = logging.getLogger('connector') |
@@ -40,7 +40,6 @@ def __init__( |
40 | 40 | self.bakery_client = bakery_client |
41 | 41 | self._connection = None |
42 | 42 | self._log_connection = None |
43 | | - self.controller_name = None |
44 | 43 | self.controller_uuid = None |
45 | 44 | self.model_name = None |
46 | 45 | self.jujudata = jujudata or FileJujuData() |
@@ -85,11 +84,6 @@ async def connect(self, **kwargs): |
85 | 84 | await self._connection.close() |
86 | 85 | self._connection = await Connection.connect(**kwargs) |
87 | 86 |
|
88 | | - if not self.controller_name: |
89 | | - if 'endpoint' not in kwargs: |
90 | | - raise PylibjujuProgrammingError("Please report this error to the maintainers.") |
91 | | - self.controller_name = self.jujudata.controller_name_by_endpoint(kwargs['endpoint']) |
92 | | - |
93 | 87 | # Check if we support the target controller |
94 | 88 | juju_server_version = self._connection.info['server-version'] |
95 | 89 | if not juju_server_version.startswith(TARGET_JUJU_VERSION): |
@@ -132,7 +126,6 @@ async def connect_controller(self, controller_name=None, specified_facades=None) |
132 | 126 | specified_facades=specified_facades, |
133 | 127 | proxy=proxy, |
134 | 128 | ) |
135 | | - self.controller_name = controller_name |
136 | 129 | self.controller_uuid = controller["uuid"] |
137 | 130 |
|
138 | 131 | async def connect_model(self, _model_name=None, **kwargs): |
@@ -188,9 +181,8 @@ async def connect_model(self, _model_name=None, **kwargs): |
188 | 181 | await self.connect(**kwargs) |
189 | 182 | # TODO this might be a good spot to trigger refreshing the |
190 | 183 | # local cache (the connection to the model might help) |
191 | | - self.controller_name = controller_name |
192 | 184 | self.model_name = controller_name + ':' + _model_name |
193 | | - return self.controller_name, model_uuid |
| 185 | + return model_uuid |
194 | 186 |
|
195 | 187 | def bakery_client_for_controller(self, controller_name): |
196 | 188 | '''Make a copy of the bakery client with a the appropriate controller's |
|
0 commit comments