From 312598fdc7ba2f2c8cf0bdc19612aa6543d54dbf Mon Sep 17 00:00:00 2001 From: Renata Date: Wed, 10 Jan 2024 17:47:03 +0100 Subject: [PATCH] fix: fix yk and GitError imports, run updater without ykman --- taf/api/utils/_roles.py | 5 ++++- taf/keys.py | 2 +- taf/updater/updater_pipeline.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/taf/api/utils/_roles.py b/taf/api/utils/_roles.py index 226ca25fa..677d18f16 100644 --- a/taf/api/utils/_roles.py +++ b/taf/api/utils/_roles.py @@ -5,7 +5,6 @@ from tuf.repository_tool import Repository as TUFRepository, Targets from taf.exceptions import TAFError from taf.models.types import RolesIterator -from taf.yubikey import get_key_serial_by_id from tuf.repository_tool import Metadata from taf.keys import get_key_name from taf.auth_repo import AuthenticationRepository @@ -18,6 +17,10 @@ from taf.models.types import Role from taf.log import taf_logger +try: + from taf.yubikey import get_key_serial_by_id +except ImportError: + pass @log_on_start(INFO, "Creating delegations", logger=taf_logger) @log_on_end(DEBUG, "Finished creating delegations", logger=taf_logger) diff --git a/taf/keys.py b/taf/keys.py index a2306ed1b..824744e24 100644 --- a/taf/keys.py +++ b/taf/keys.py @@ -10,7 +10,6 @@ from taf.models.models import TAFKey from taf.models.types import TargetsRole, MainRoles, UserKeyData from taf.repository_tool import Repository -from taf.yubikey import get_key_serial_by_id from tuf.repository_tool import ( generate_and_write_unencrypted_rsa_keypair, generate_and_write_rsa_keypair, @@ -32,6 +31,7 @@ try: import taf.yubikey as yk + from taf.yubikey import get_key_serial_by_id from taf.yubikey import export_yk_certificate except ImportError: taf_logger.warning( diff --git a/taf/updater/updater_pipeline.py b/taf/updater/updater_pipeline.py index c901bd496..a942be110 100644 --- a/taf/updater/updater_pipeline.py +++ b/taf/updater/updater_pipeline.py @@ -7,7 +7,7 @@ import tempfile from typing import Any, Dict, List, Optional from attr import attrs, define, field -from git import GitError +from taf.git import GitError from logdecorator import log_on_end, log_on_start from taf.git import GitRepository