@@ -113,7 +113,7 @@ async def connect_controller(self, controller_name=None, specified_facades=None)
113113 self .controller_name = controller_name
114114 self .controller_uuid = controller ["uuid" ]
115115
116- async def connect_model (self , model_name = None , ** kwargs ):
116+ async def connect_model (self , _model_name = None , ** kwargs ):
117117 """Connect to a model by name. If either controller or model
118118 parts of the name are empty, the current controller and/or model
119119 will be used.
@@ -122,7 +122,7 @@ async def connect_model(self, model_name=None, **kwargs):
122122 """
123123
124124 try :
125- controller_name , model_name = self .jujudata .parse_model (model_name )
125+ controller_name , _model_name = self .jujudata .parse_model (_model_name )
126126 controller = self .jujudata .controllers ().get (controller_name )
127127 except JujuError as e :
128128 raise JujuConnectionError (e .message ) from e
@@ -134,8 +134,8 @@ async def connect_model(self, model_name=None, **kwargs):
134134 models = self .jujudata .models ().get (controller_name , {}).get ('models' ,
135135 {})
136136 model_uuid = None
137- if model_name in models :
138- model_uuid = models [model_name ]['uuid' ]
137+ if _model_name in models :
138+ model_uuid = models [_model_name ]['uuid' ]
139139 else :
140140 # let's try to find it through the actual controller
141141 await self .connect_controller (controller_name = controller_name )
@@ -146,11 +146,11 @@ async def connect_model(self, model_name=None, **kwargs):
146146 response = await controller_facade .AllModels ()
147147 # search the one that contains admin/model_name
148148 for user_model in response .user_models :
149- if 'admin/' + user_model .model .name == model_name :
149+ if 'admin/' + user_model .model .name == _model_name :
150150 model_uuid = user_model .model .uuid
151151
152152 if model_uuid is None :
153- raise JujuConnectionError ('Model not found: {}' .format (model_name ))
153+ raise JujuConnectionError ('Model not found: {}' .format (_model_name ))
154154
155155 proxy = proxy_from_config (controller .get ('proxy-config' , None ))
156156
@@ -167,7 +167,8 @@ async def connect_model(self, model_name=None, **kwargs):
167167 # TODO this might be a good spot to trigger refreshing the
168168 # local cache (the connection to the model might help)
169169 self .controller_name = controller_name
170- self .model_name = controller_name + ':' + model_name
170+ self .model_name = controller_name + ':' + _model_name
171+ return self .controller_name , model_uuid
171172
172173 def bakery_client_for_controller (self , controller_name ):
173174 '''Make a copy of the bakery client with a the appropriate controller's
0 commit comments