Skip to content

Commit ee3bbea

Browse files
committed
Continue trying other auth if credHelper or credsStore fails
Signed-off-by: Rasmus Faber-Espensen <rfaber@gmail.com>
1 parent 5cfdf26 commit ee3bbea

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

oras/auth/base.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def logout(self, hostname: str):
6464
def _logout(self):
6565
pass
6666

67-
def _get_auth_from_creds_store(self, binary: str, hostname: str) -> str:
67+
def _get_auth_from_creds_store(self, binary: str, hostname: str) -> str | None:
6868
try:
6969
proc = subprocess.run(
7070
[binary, "get"],
@@ -73,14 +73,12 @@ def _get_auth_from_creds_store(self, binary: str, hostname: str) -> str:
7373
stderr=subprocess.PIPE,
7474
check=True,
7575
)
76-
except FileNotFoundError as exc:
77-
raise RuntimeError(
78-
f"Credential helper '{binary}' not found in PATH"
79-
) from exc
76+
except FileNotFoundError:
77+
logger.warning(f"Credential helper '{binary}' not found in PATH")
78+
return None
8079
except subprocess.CalledProcessError as exc:
81-
raise RuntimeError(
82-
f"Credential helper '{binary}' failed: {exc.stderr.decode().strip()}"
83-
) from exc
80+
logger.warning(f"Credential helper '{binary}' failed: {exc.stderr.decode().strip()}")
81+
return None
8482
payload = json.loads(proc.stdout)
8583
return auth_utils.get_basic_auth(payload["Username"], payload["Secret"])
8684

0 commit comments

Comments
 (0)