Skip to content

Commit

Permalink
moving glue check
Browse files Browse the repository at this point in the history
  • Loading branch information
brifordwylie committed Jan 25, 2024
1 parent 9d4204e commit dd7f251
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/sageworks/aws_service_broker/aws_account_clamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def glue_check(cls):
Returns:
bool: True if running in AWS Glue environment, False otherwise.
"""
# Define a set of environment variables typical for AWS Glue
try:
import awsglue
return True
Expand All @@ -141,11 +140,6 @@ def glue_check(cls):
def _session_credentials(cls):
"""Internal: Set up our AWS Session credentials for automatic refresh"""

# Check if running in AWS Glue and skip role assumption if true
if cls.glue_check():
cls.log.info("Running inside AWS Glue. Skipping Role Assumption.")
return boto3.Session().get_credentials().get_frozen_credentials()

# Assume the SageWorks Execution Role and then pull the credentials
cls.log.debug("Assuming the SageWorks Execution Role and Refreshing Credentials...")
sts = boto3.Session().client("sts")
Expand All @@ -165,7 +159,7 @@ def _session_credentials(cls):

@classmethod
def _init_boto3_session(cls):
if cls.is_sageworks_role():
if cls.is_sageworks_role() or cls.glue_check():
return boto3.Session()

refreshable_credentials = RefreshableCredentials.create_from_metadata(
Expand Down

0 comments on commit dd7f251

Please sign in to comment.