Skip to content

Commit

Permalink
fix last coverage issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Mar 9, 2024
1 parent ca2d168 commit 62ffd13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ca/django_ca/key_backends/storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def load_default_password(cls, password: Optional[bytes], info: ValidationInfo)
"""Validator to load the password from CA_PASSWORDS if not given."""
if info.context and password is None:
ca: CertificateAuthority = info.context.get("ca")
if ca:
if ca: # pragma: no branch
if settings_password := ca_settings.CA_PASSWORDS.get(ca.serial):
return settings_password

Expand Down Expand Up @@ -206,7 +206,9 @@ def create_private_key(
# Update model instance
ca.key_backend_options = {"path": path}

use_private_key_options = UsePrivateKeyOptions(password=options.password)
use_private_key_options = UsePrivateKeyOptions.model_validate(
{"password": options.password}, context={"ca": ca}
)

return key.public_key(), use_private_key_options

Expand Down

0 comments on commit 62ffd13

Please sign in to comment.