Skip to content

Commit

Permalink
Ask for credentials if some missing before connect
Browse files Browse the repository at this point in the history
Fixes #1001
  • Loading branch information
cderici committed Feb 7, 2024
1 parent 2154a9e commit e203dd7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions juju/client/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ async def connect(self, **kwargs):
if 'password' not in kwargs and account.get('password'):
kwargs.update(password=account.get('password'))

if not ({'username', 'password'}.issubset(kwargs)):
required = {'username', 'password'}.difference(kwargs)
raise ValueError(f'Some authentication parameters are required : {",".join(required)}')
self._connection = await Connection.connect(**kwargs)

# Check if we support the target controller
Expand Down

0 comments on commit e203dd7

Please sign in to comment.