Skip to content

Commit

Permalink
Adjustment to fix linting error after stubs update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Skipper committed Dec 19, 2023
1 parent 33120c3 commit f16f69c
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions runway/context/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,16 @@ def _inject_profile_credentials(self) -> None: # cov: ignore
if self.current_aws_creds or not self.env.aws_profile:
return

creds = (
self.get_session(profile=self.env.aws_profile)
.get_credentials()
.get_frozen_credentials()
)

self.env.vars["AWS_ACCESS_KEY_ID"] = creds.access_key
self.env.vars["AWS_SECRET_ACCESS_KEY"] = creds.secret_key
if creds.token:
self.env.vars["AWS_SESSION_TOKEN"] = creds.token
try:
creds = self.get_session(profile=self.env.aws_profile).get_credentials()
if creds is not None:
frozen_creds = creds.get_frozen_credentials()
self.env.vars["AWS_ACCESS_KEY_ID"] = frozen_creds.access_key
self.env.vars["AWS_SECRET_ACCESS_KEY"] = frozen_creds.secret_key
if frozen_creds.token:
self.env.vars["AWS_SESSION_TOKEN"] = frozen_creds.token
else:
raise ValueError("Credentials could not be retrieved from the session.")
except Exception as e:
# Handle the exception as needed
self.logger.error("An error occurred: %s", e)

0 comments on commit f16f69c

Please sign in to comment.