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

Uploading to incorrect folder #7

Open
chrisvanpatten opened this issue Sep 11, 2017 · 1 comment
Open

Uploading to incorrect folder #7

chrisvanpatten opened this issue Sep 11, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@chrisvanpatten
Copy link

I've searched around a bit and I'm fairly convinced this is a bug, not a PEBKAC (although apologies if it is!)

I have a linked dir setup like this:

set :linked_dirs, ['config/credentials']

Capistrano correctly creates the directory at /home/user/application/shared/config/credentials/, and symlinks it appropriately in /home/user/application/current/config/credentials/.

However, when the contents of that folder are initially uploaded, they're uploaded to /home/user/application/shared/credentials/*. That means the actual symlinked folder is empty, as the files are in the wrong place.

I've hunted around a bit for a solution but haven't encountered anything yet. Any ideas what might be going wrong?

@Blysq
Copy link

Blysq commented Dec 19, 2018

I'm not a contributor but I can confirm this is an issue.

https://github.com/runar/capistrano-linked-files/blob/master/lib/capistrano/tasks/linked_files.rake#L35 needs to be changed.

SSHKit upload! method automatically creates the last level of the path of the arg1 at the arg2 location. It only creates the last level of the path at the arg2 location tho. For this to work, the last path level needs to be stripped from arg2.

I suggest adding something like (line 35) of lib/capistrano/tasks/linked_files.rake:
path = Pathname.new("#{shared_path}/#{dir}/").split.first.to_s
upload! dir, path, recursive: true

don't forget to require 'pathname' before the code

@runar runar self-assigned this May 3, 2019
@runar runar added this to the 1.3.0 milestone May 3, 2019
@runar runar added the bug label May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants