Skip to content

Commit 55cb2e1

Browse files
committed
Updated pr.
1 parent 7d54193 commit 55cb2e1

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

ads/common/auth.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -517,17 +517,12 @@ def create_signer(self) -> Dict:
517517
"""
518518
if self.oci_config:
519519
configuration = ads.telemetry.update_oci_client_config(self.oci_config)
520+
elif self.signer_kwargs:
521+
configuration = ads.telemetry.update_oci_client_config(self.signer_kwargs)
520522
else:
521-
try:
522-
configuration = ads.telemetry.update_oci_client_config(
523-
oci.config.from_file(self.oci_config_location, self.oci_key_profile)
524-
)
525-
except:
526-
if not os.path.exists(os.path.expanduser(self.oci_config_location)):
527-
logger.info(f"Failed to get config from folder {self.oci_config_location}. Using 'signer_kwargs' instead.")
528-
configuration = ads.telemetry.update_oci_client_config(self.signer_kwargs)
529-
else:
530-
raise
523+
configuration = ads.telemetry.update_oci_client_config(
524+
oci.config.from_file(self.oci_config_location, self.oci_key_profile)
525+
)
531526

532527
logger.info(f"Using 'api_key' authentication.")
533528
return {

tests/unitary/default_setup/auth/test_auth.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def test_set_auth_with_kwargs(self, mock_load_private_key):
114114
assert signer["config"]["key_content"] == "test_key_content"
115115
assert "additional_user_agent" in signer["config"]
116116
assert signer["signer"] != None
117+
set_auth()
117118

118119
class TestOCIMixin(TestCase):
119120
def tearDown(self) -> None:

0 commit comments

Comments
 (0)