Skip to content

Include role path in get_execution_role() result #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 28, 2018

Conversation

laurenyu
Copy link
Contributor

Description of changes:
The current STS GetCallerIdentity call returns only the role name, but not the role path. As a result, the result of get_execution_role() is incorrect if the assumed role has a path.

This was tested manually in SageMaker Notebook Instances with different roles to test the different cases.

Merge Checklist

_Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have updated the changelog with a description of my changes (if appropriate)
  • I have updated any necessary documentation (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

laurenyu added 2 commits June 27, 2018 22:45
The current STS GetCallerIdentity call returns only the role name,
but not the role path. As a result, the result of get_execution_role() is
incorrect if the assumed role has a path.
@laurenyu laurenyu requested a review from nadiaya June 28, 2018 05:51
@codecov-io
Copy link

codecov-io commented Jun 28, 2018

Codecov Report

Merging #268 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #268      +/-   ##
=========================================
+ Coverage   92.34%   92.4%   +0.06%     
=========================================
  Files          49      49              
  Lines        3277    3279       +2     
=========================================
+ Hits         3026    3030       +4     
+ Misses        251     249       -2
Impacted Files Coverage Δ
src/sagemaker/session.py 86.9% <100%> (+0.07%) ⬆️
src/sagemaker/local/image.py 86.8% <0%> (+0.58%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 864c653...e784423. Read the comment docs.

Copy link
Contributor

@nadiaya nadiaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we retest all of our notebooks?

@laurenyu
Copy link
Contributor Author

Not sure if we need to test all of our notebooks - the main difference is the execution role, not the notebook material. I had a notebook with an execution role that didn't have a slash and also made one with an execution role with a slash, and this change worked for both of those.

@nadiaya nadiaya merged commit 7c2073c into aws:master Jun 28, 2018
nadiaya added a commit that referenced this pull request Jun 28, 2018
@laurenyu laurenyu deleted the get-full-role branch June 28, 2018 19:54
@zmjjmz
Copy link

zmjjmz commented Jul 10, 2018

Hey there,

I just ran into an issue with this since the role I was using didn't have iam:GetRole allowed. It was an easy fix, but I had to spend a bit of time debugging my DAGs and such :)

If there could have been some sort of warning / explicit handling of a permission failure, that would be appreciated.

Thanks!

@laurenyu
Copy link
Contributor Author

@zmjjmz thanks for bringing that up! do you mind opening a new issue about this? that'll make it easier for us to track and resolve.

knakad added a commit to knakad/sagemaker-python-sdk that referenced this pull request Nov 27, 2019
* predictor.list_monitors() now returns a list of monitors.
* monitor.update/start/stop now waits for schedule to finish updating
before returning.
* monitor.create will fail if a schedule was already created,
explaining to the user that they must first delete a schedule before
creating a new one.
* fixed shallow copy on env to avoid mutating customer environment
dictionary
* fix integration tests based on latest API changes
* no longer relying on schedule defaults in ITs until API is updated.
* add missed imports to init to simplify user experience
* remove broken assert because API now randomizes schedule if not provided
* fix bug when attaching to monitor with entrypoint not specified
knakad added a commit to knakad/sagemaker-python-sdk that referenced this pull request Dec 4, 2019
* predictor.list_monitors() now returns a list of monitors.
* monitor.update/start/stop now waits for schedule to finish updating
before returning.
* monitor.create will fail if a schedule was already created,
explaining to the user that they must first delete a schedule before
creating a new one.
* fixed shallow copy on env to avoid mutating customer environment
dictionary
* fix integration tests based on latest API changes
* no longer relying on schedule defaults in ITs until API is updated.
* add missed imports to init to simplify user experience
* remove broken assert because API now randomizes schedule if not provided
* fix bug when attaching to monitor with entrypoint not specified
knakad added a commit that referenced this pull request Dec 4, 2019
* predictor.list_monitors() now returns a list of monitors.
* monitor.update/start/stop now waits for schedule to finish updating
before returning.
* monitor.create will fail if a schedule was already created,
explaining to the user that they must first delete a schedule before
creating a new one.
* fixed shallow copy on env to avoid mutating customer environment
dictionary
* fix integration tests based on latest API changes
* no longer relying on schedule defaults in ITs until API is updated.
* add missed imports to init to simplify user experience
* remove broken assert because API now randomizes schedule if not provided
* fix bug when attaching to monitor with entrypoint not specified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants