Skip to content
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

Use the S3 key as the default ouput file name #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

calvn
Copy link

@calvn calvn commented Apr 6, 2016

No description provided.

@ktheory
Copy link
Contributor

ktheory commented Apr 6, 2016

@cleung2010 Hi! Thank you for using docker-s3-sync.

Were you having a problem that this change fixed? Curious what the motivation is for this pull request.

@calvn
Copy link
Author

calvn commented Apr 7, 2016

I would think that setting the DESTINATION path would be like cp or mv, where if you you don't specify the filename, the target file will have the same name as the source. Currently if the destination is a directory, the filename will default to out which is a bit odd.

@ktheory
Copy link
Contributor

ktheory commented Apr 7, 2016

Currently if the destination is a directory, the filename will default to out which is a bit odd.

Oh, good point. I'd always fully specified the destination instead of giving a directory.

What about the case when the S3 key contains slashes? For example, path/to/s3_file.

Would you expect the file to live in /destination/path/to/s3_file? In that case, you'll need to mkdir -p $(dirname $S3_KEY).

If you'd expect it to live in /destination/s3_file, you'll want to write the file to $(basename $S3_KEY).

@calvn
Copy link
Author

calvn commented Apr 7, 2016

Right, I don't know what is the right call here, whether it should be /destination/path/to/s3_file or /destination/s3_file.

@calvn
Copy link
Author

calvn commented Apr 7, 2016

Actually, if the image is used to sync a single file I think it would make more sense to use $(basename $S3_KEY) rather than making the directory tree for the file.

@calvn
Copy link
Author

calvn commented Apr 7, 2016

Also encountered a potential problem with the sync.sh. If OWNER_UID is not provided, the file will be owned by root:root, but the mv command might get permission denied if sync.sh is not executed by root. Changing it to cp eliminated the problem since the file is globally readable by default.

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.

2 participants