Skip to content

Make sure that an arn including 'role' won't pass #65

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

Closed
wants to merge 6 commits into from

Conversation

matthieudelaro
Copy link

Currently, an ARN such as the following 'arn:aws:iam::424242424242:user/matthieu_role' is accepted as a valid ARN by the get_execution_role() function, despite the fact that a test has been implemented:

    if 'role' in arn:
        return arn
    message = 'The current AWS identity is not a role: {}, therefore it cannot be used as a SageMaker execution role'
    raise ValueError(message.format(arn))

Unfortunately, the test passes if ever the arn includes the term 'role'.

This commit improves this test by testing that 'role' is between a : and a /, in order to match arn like arn:aws:iam::424242424242:role/sagemaker_role_matthieu

@mvsusp
Copy link
Contributor

mvsusp commented Jan 31, 2018

Thanks for contributing @matthieudelaro.
Can you add a unit test on

def test_get_execution_role():

with the missing use?

@mvsusp mvsusp self-requested a review January 31, 2018 16:54
Copy link
Contributor

@mvsusp mvsusp left a comment

Choose a reason for hiding this comment

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

Please add unit tests.

@codecov-io
Copy link

codecov-io commented Apr 6, 2018

Codecov Report

Merging #65 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #65   +/-   ##
=======================================
  Coverage   92.79%   92.79%           
=======================================
  Files          71       71           
  Lines        5373     5373           
=======================================
  Hits         4986     4986           
  Misses        387      387
Impacted Files Coverage Δ
src/sagemaker/session.py 83.42% <100%> (ø) ⬆️

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 4ffdeda...355f318. Read the comment docs.

nadiaya added a commit to nadiaya/sagemaker-python-sdk that referenced this pull request Jun 20, 2018
* Add initial Readme commit for PyTorch.

* Update table of contents. Readme updates.

* Add more info about distributed training.

* PR comments.

* Add notes about argparse actions and how to use boolean hyperparameters.
apacker pushed a commit to apacker/sagemaker-python-sdk that referenced this pull request Nov 15, 2018
Add gluon sentiment analysis
@laurenyu
Copy link
Contributor

continued this PR in #570

@matthieudelaro
Copy link
Author

@laurenyu, thanks a lot for all you work that made the merging possible!

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.

6 participants