Skip to content

Commit

Permalink
Merge pull request #527 from cderici/master
Browse files Browse the repository at this point in the history
#527

Fixes #524
  • Loading branch information
jujubot authored Aug 25, 2021
2 parents 88a752b + cc2b7d5 commit 8a03711
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
20 changes: 9 additions & 11 deletions juju/client/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ async def connect(self, **kwargs):
kwargs are passed through to Connection.connect()
"""

kwargs.setdefault('loop', self.loop)
kwargs.setdefault('max_frame_size', self.max_frame_size)
kwargs.setdefault('bakery_client', self.bakery_client)
Expand Down Expand Up @@ -106,7 +105,7 @@ async def connect_controller(self, controller_name=None, specified_facades=None)
self.controller_name = controller_name
self.controller_uuid = controller["uuid"]

async def connect_model(self, model_name=None):
async def connect_model(self, model_name=None, **kwargs):
"""Connect to a model by name. If either controller or model
parts of the name are empty, the current controller and/or model
will be used.
Expand Down Expand Up @@ -138,15 +137,14 @@ async def connect_model(self, model_name=None):
# haven't necessarily synced with the local juju data,
# and also remove the need for base.CleanModel to
# subclass JujuData.
await self.connect(
endpoint=endpoints,
uuid=models[model_name]['uuid'],
username=account.get('user'),
password=account.get('password'),
cacert=controller.get('ca-cert'),
bakery_client=self.bakery_client_for_controller(controller_name),
proxy=proxy,
)
kwargs.update(endpoint=endpoints,
uuid=models[model_name]['uuid'],
username=account.get('user'),
password=account.get('password'),
cacert=controller.get('ca-cert'),
bakery_client=self.bakery_client_for_controller(controller_name),
proxy=proxy)
await self.connect(**kwargs)
self.controller_name = controller_name
self.model_name = controller_name + ':' + model_name

Expand Down
4 changes: 2 additions & 2 deletions juju/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,12 +583,12 @@ async def connect(self, *args, **kwargs):
await self._connector.connect(**kwargs)
await self._after_connect()

async def connect_model(self, model_name):
async def connect_model(self, model_name, **kwargs):
"""
.. deprecated:: 0.6.2
Use ``connect(model_name=model_name)`` instead.
"""
return await self.connect(model_name=model_name)
return await self.connect(model_name=model_name, **kwargs)

async def connect_current(self):
"""
Expand Down

0 comments on commit 8a03711

Please sign in to comment.