Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

trailing slash required in bucket_prefix #11

Open
klumhru opened this issue Jun 15, 2017 · 3 comments · May be fixed by #12
Open

trailing slash required in bucket_prefix #11

klumhru opened this issue Jun 15, 2017 · 3 comments · May be fixed by #12

Comments

@klumhru
Copy link

klumhru commented Jun 15, 2017

I had a problem with the stack where I had set the S3BucketPrefix to vpnconfigs/prefix_

This broke the cisco configurator lambda as it does a string split on "/" and joins on [:-2]. This drops the "prefix_" part.

transit-vpc-push-cicso-config.py@L128

def getBucketPrefix(bucket_name, bucket_key):
    #Figure out prefix from known bucket_name and bucket_key
    bucket_prefix = '/'.join(bucket_key.split('/')[:-2])
    if len(bucket_prefix) > 0:
        bucket_prefix += '/'
    return bucket_prefix

All this is fine, but it would be nice if the docs would specify that the value for bucket prefix must have a trailing slash.

@stevemorad
Copy link
Contributor

Thank you for the feedback. We updated the documentation to include the requirement that the bucket prefix end with a trailing slash.

@stevemorad
Copy link
Contributor

I saw your fork with a "AllowedPattern" update to the template. I really like this approach beyond just adding information to the documentation. However, looking at your example:
"AllowedPattern": "^[a-z0-9A-Z][a-z0-9A-Z/]+/$"

I believe this will require a prefix that starts with one letter or number and contains at least one more letter, number, or forward slash, followed by another '/'

This precludes "no" prefix (just a '/') as well as an prefix with a dash, underscore, or period in it. What do you think of the following pattern instead?

"AllowedPattern": "^[a-z0-9A-Z_/-./]*/$"

Which requires a trailing '/', but allows letters, numbers, dashes, underscores, periods, or forward slashes. Are there other characters we would also want to include?

@stevemorad stevemorad reopened this Jun 17, 2017
@klumhru
Copy link
Author

klumhru commented Jun 17, 2017

@stevemorad yep, that seems to resolve it neatly as it requires the trailing slash. I didn't have time to finish my implementation to my satisfaction :)

klumhru added a commit to ccpgames/aws-transit-vpc that referenced this issue Jun 18, 2017
klumhru added a commit to ccpgames/aws-transit-vpc that referenced this issue Jun 18, 2017
@klumhru klumhru linked a pull request Jun 18, 2017 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants