diff --git a/src/harbor/commands.py b/src/harbor/commands.py index 5e4f378..12c643a 100644 --- a/src/harbor/commands.py +++ b/src/harbor/commands.py @@ -6,30 +6,13 @@ import time from argparse import Namespace from datetime import datetime, timezone -from .client import api_request, paginated_request, resolve_digest +from .client import api_request, resolve_digest from .constants import ( ADMIN_PAGE_SIZE, - COL_ACTION, COL_ADMIN, COL_CREATED, - COL_CVE, - COL_DIGEST, COL_EMAIL, - COL_OPERATION, - COL_PACKAGE, - COL_PROJECT, - COL_REPO, - COL_RESOURCE, - COL_SCHEDULE, - COL_SEVERITY, - COL_SIZE, - COL_STATUS, - COL_TAG, - COL_TAGS, - COL_TIME, COL_USERNAME, - COL_VERSION, - DEFAULT_RESULT_LIMIT, GC_SCHEDULE_MANUAL, HTTP_ACCEPTED, HTTP_CREATED, @@ -799,7 +782,7 @@ def cmd_gc_run(args: Namespace, user: str, password: str, url: str) -> int: latest = history[0] status = latest.get("job_status", "") if status == "Success": - print(f"\nGC complete") + print("\nGC complete") return 0 elif status in ("Error", "Failed", "Stopped"): print(f"\nGC failed: {status}") @@ -916,7 +899,7 @@ def cmd_user_create(args: Namespace, user: str, password: str, url: str) -> int: if admin_result.get("status") == HTTP_OK or not admin_result.get("error"): print(f"Granted admin privileges to: {username}") else: - print(f"Warning: Failed to grant admin privileges") + print("Warning: Failed to grant admin privileges") print_error(admin_result) return 0 @@ -1094,9 +1077,6 @@ def cmd_audit_purge(args: Namespace, user: str, password: str, url: str) -> int: print("Aborted") return 0 - # Get current purge schedule - current = api_request(f"{url}/api/v2.0/system/purgeaudit/schedule", user, password) - # Build schedule payload payload = { "schedule": { diff --git a/src/harbor/tests/test_client.py b/src/harbor/tests/test_client.py index 977c24f..34c56ef 100644 --- a/src/harbor/tests/test_client.py +++ b/src/harbor/tests/test_client.py @@ -4,7 +4,6 @@ import unittest from unittest.mock import patch from harbor.client import build_url, resolve_digest -from harbor.constants import SHA256_PREFIX class TestBuildUrl(unittest.TestCase):