File tree 3 files changed +16
-2
lines changed
3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 2
2
CHANGELOG
3
3
=========
4
4
5
+ 1.16.4.dev
6
+ ==========
7
+
8
+ * bug-fix: Session: don't allow get_execution_role() to return an ARN that's not a role but has "role" in the name
9
+
5
10
1.16.3
6
11
======
7
12
8
- * bug-fix: Local Mode: Allow support for SSH in local mode
13
+ * bug-fix: Local Mode: Allow support for SSH in local mode
9
14
* bug-fix: Append retry id to default Airflow job name to avoid name collisions in retry
10
15
* bug-fix: Local Mode: No longer requires s3 permissions to run local entry point file
11
16
* feature: Estimators: add support for PyTorch 1.0.0
Original file line number Diff line number Diff line change @@ -1212,7 +1212,7 @@ def get_execution_role(sagemaker_session=None):
1212
1212
sagemaker_session = Session ()
1213
1213
arn = sagemaker_session .get_caller_identity_arn ()
1214
1214
1215
- if 'role' in arn :
1215
+ if ': role/ ' in arn :
1216
1216
return arn
1217
1217
message = 'The current AWS identity is not a role: {}, therefore it cannot be used as a SageMaker execution role'
1218
1218
raise ValueError (message .format (arn ))
Original file line number Diff line number Diff line change @@ -65,6 +65,15 @@ def test_get_execution_role_throws_exception_if_arn_is_not_role():
65
65
assert 'ValueError: The current AWS identity is not a role' in str (error )
66
66
67
67
68
+ def test_get_execution_role_throws_exception_if_arn_is_not_role_with_role_in_name ():
69
+ session = Mock ()
70
+ session .get_caller_identity_arn .return_value = 'arn:aws:iam::369233609183:user/marcos-role'
71
+
72
+ with pytest .raises (ValueError ) as error :
73
+ get_execution_role (session )
74
+ assert 'ValueError: The current AWS identity is not a role' in str (error )
75
+
76
+
68
77
def test_get_caller_identity_arn_from_an_user (boto_session ):
69
78
sess = Session (boto_session )
70
79
arn = 'arn:aws:iam::369233609183:user/mia'
You can’t perform that action at this time.
0 commit comments