-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
extended title validation #389
Conversation
also adding an option do define own title checks IAM limits are documented at http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html
# unset/None is also legal | ||
if title and not valid_names.match(title): | ||
# some objects allow more characters than others | ||
if title and 'validate_title' in dir(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it maybe make more sense to do away with this logic and instead move the valid_names.match
into a default validate_title
method? It'd make this a bit cleaner. This would become:
if title:
self.validate_title()
…en for custom title validators
You are right, this is a nicer way to implement this. Updated the PR |
if title and not valid_names.match(title): | ||
raise ValueError('Name "%s" not alphanumeric' % title) | ||
# try to validate the title if its there | ||
if self.title is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.title
is more pythonic, and should do what you want here. Otherwise I think this is good to go.
updated |
Awesome, thanks @webratz ! |
This PR adds the option to have custom title validators, as the default one is often to restrictive (AWS allows more characters)
Also there are some new checks for IAM Objects which help you catching errors before you run the CF template.