Skip to content

Commit e94a2b7

Browse files
committed
Update serializer.py to add default auth for oci.
1 parent e11a17c commit e94a2b7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ads/common/serializer.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import yaml
1616

1717
from ads.common import logger
18+
from ads.common.auth import default_signer
1819

1920
try:
2021
from yaml import CSafeDumper as dumper
@@ -134,6 +135,14 @@ def _read_from_file(uri: str, **kwargs) -> str:
134135
-------
135136
string: Contents in file specified by URI
136137
"""
138+
# Add default signer if the uri is an object storage uri, and
139+
# the user does not specify config or signer.
140+
if (
141+
uri.startswith("oci://")
142+
and "config" not in kwargs
143+
and "signer" not in kwargs
144+
):
145+
kwargs.update(default_signer())
137146
with fsspec.open(uri, "r", **kwargs) as f:
138147
return f.read()
139148

0 commit comments

Comments
 (0)