Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix audb.versions() for private repos #352

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions audb/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,8 @@ def versions(
for repository in config.REPOSITORIES:
backend = utils.access_backend(repository)
if isinstance(backend, audbackend.Artifactory):
import artifactory

# Avoid using ls() on Artifactory
# see https://github.com/devopshq/artifactory/issues/423
folder = backend.join("/", name, "db")
Expand All @@ -609,12 +611,22 @@ def versions(
backend._username,
backend._api_key,
)
if path.exists():
for p in path:
version = p.parts[-1]
header = p.joinpath(f"db-{version}.yaml")
if header.exists():
vs.extend([version])
try:
if path.exists():
for p in path:
version = p.parts[-1]
header = p.joinpath(f"db-{version}.yaml")
if header.exists():
vs.extend([version])
except artifactory.ArtifactoryException: # pragma: nocover
# This tackles the case of missing repo
# or missing read permissions.
# We cannot test this at the moment
# on the public Artifactory server.
# Because after trying
# to connect to a repo without read access
# the connection is also blocked for valid repos.
pass
else:
header = backend.join("/", name, "db.yaml")
vs.extend(backend.versions(header, suppress_backend_errors=True))
Expand Down
Loading