less optional around ssl (#10558)

* less optional

* clean up cruft

* more

* more

* just a little less optional
This commit is contained in:
Kyle Altendorf 2022-03-17 12:06:22 -04:00 committed by GitHub
parent 6e499e0e62
commit aead84a346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -124,7 +124,7 @@ class DaemonProxy:
return await self._get(request)
async def connect_to_daemon(self_hostname: str, daemon_port: int, ssl_context: Optional[ssl.SSLContext]) -> DaemonProxy:
async def connect_to_daemon(self_hostname: str, daemon_port: int, ssl_context: ssl.SSLContext) -> DaemonProxy:
"""
Connect to the local daemon.
"""

View File

@ -42,7 +42,7 @@ def ssl_context_for_server(
*,
check_permissions: bool = True,
log: Optional[logging.Logger] = None,
) -> Optional[ssl.SSLContext]:
) -> ssl.SSLContext:
if check_permissions:
verify_ssl_certs_and_keys([ca_cert, private_cert_path], [ca_key, private_key_path], log)
@ -70,7 +70,7 @@ def ssl_context_for_server(
def ssl_context_for_root(
ca_cert_file: str, *, check_permissions: bool = True, log: Optional[logging.Logger] = None
) -> Optional[ssl.SSLContext]:
) -> ssl.SSLContext:
if check_permissions:
verify_ssl_certs_and_keys([Path(ca_cert_file)], [], log)
@ -86,7 +86,7 @@ def ssl_context_for_client(
*,
check_permissions: bool = True,
log: Optional[logging.Logger] = None,
) -> Optional[ssl.SSLContext]:
) -> ssl.SSLContext:
if check_permissions:
verify_ssl_certs_and_keys([ca_cert, private_cert_path], [ca_key, private_key_path], log)

View File

@ -353,7 +353,7 @@ class BlockTools:
def config(self) -> Dict:
return copy.deepcopy(self._config)
def get_daemon_ssl_context(self) -> Optional[ssl.SSLContext]:
def get_daemon_ssl_context(self) -> ssl.SSLContext:
crt_path = self.root_path / self.config["daemon_ssl"]["private_crt"]
key_path = self.root_path / self.config["daemon_ssl"]["private_key"]
ca_cert_path = self.root_path / self.config["private_ssl_ca"]["crt"]