Skip to content

Commit 4d1883b

Browse files
committed
refactor: replace print() with logger.info() for S3 deny policy display
Replace 10 bare print() calls with a single logger.info() call for the S3 deny policy output in enable_lake_formation(). This makes the policy display consistent with the rest of the LF workflow which uses logger. Update 12 tests to mock the logger instead of builtins.print. --- X-AI-Prompt: replace print with logger.info for s3 bucket policy display in enable_lake_formation X-AI-Tool: kiro-cli
1 parent 1964292 commit 4d1883b

2 files changed

Lines changed: 91 additions & 104 deletions

File tree

sagemaker-mlops/src/sagemaker/mlops/feature_store/feature_group.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -607,23 +607,22 @@ def enable_lake_formation(
607607
region=region,
608608
)
609609

610-
# Print policy with clear instructions
611-
print("\n" + "=" * 80)
612-
print("S3 Bucket Policy Update recommended")
613-
print("=" * 80)
614-
print(
615-
"\nTo complete Lake Formation setup, add the following deny policy to your S3 bucket."
610+
# Log policy with clear instructions
611+
policy_json = json.dumps(policy, indent=2)
612+
policy_message = (
613+
"\n" + "=" * 50
614+
+ "\nS3 Bucket Policy Update recommended"
615+
+ "\n" + "=" * 50
616+
+ "\n\nTo complete Lake Formation setup, add the following"
617+
+ "\ndeny policy to your S3 bucket."
618+
+ "\nThis restricts access to the offline store data to"
619+
+ "\nonly the allowed principals."
620+
+ f"\n\nBucket: {bucket_name}"
621+
+ f"\n\nPolicy to add:\n{policy_json}"
622+
+ "\n\nNote: Merge this with your existing bucket policy if one exists."
623+
+ "\n" + "=" * 50 + "\n"
616624
)
617-
print(
618-
"This policy restricts access to the offline store data to only the allowed principals."
619-
)
620-
print("\nBucket:", bucket_name)
621-
print("\nPolicy to add:")
622-
print("-" * 40)
623-
print(json.dumps(policy, indent=2))
624-
print("-" * 40)
625-
print("\nNote: Merge this with your existing bucket policy if one exists.")
626-
print("=" * 80 + "\n")
625+
logger.info(policy_message)
627626

628627
return results
629628

0 commit comments

Comments
 (0)