Fix cli discover bug with None username/password (#615)

This commit is contained in:
sdb9696 2024-01-04 18:17:48 +00:00 committed by GitHub
parent 1bb930b096
commit b156defc3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -64,7 +64,9 @@ class AesTransport(BaseTransport):
super().__init__(config=config)
self._login_version = config.connection_type.login_version
if not self._credentials and not self._credentials_hash:
if (
not self._credentials or self._credentials.username is None
) and not self._credentials_hash:
self._credentials = Credentials()
if self._credentials:
self._login_params = self._get_login_params()

View File

@ -395,7 +395,7 @@ async def discover(ctx):
timeout = ctx.parent.params["timeout"]
port = ctx.parent.params["port"]
credentials = Credentials(username, password)
credentials = Credentials(username, password) if username and password else None
sem = asyncio.Semaphore()
discovered = dict()

View File

@ -100,7 +100,9 @@ class KlapTransport(BaseTransport):
self._default_http_client: Optional[httpx.AsyncClient] = None
self._local_seed: Optional[bytes] = None
if not self._credentials and not self._credentials_hash:
if (
not self._credentials or self._credentials.username is None
) and not self._credentials_hash:
self._credentials = Credentials()
if self._credentials:
self._local_auth_hash = self.generate_auth_hash(self._credentials)