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

Restore manifest is failing on rollback on multiple hosts #204

Open
mckomo opened this issue Aug 2, 2017 · 2 comments
Open

Restore manifest is failing on rollback on multiple hosts #204

mckomo opened this issue Aug 2, 2017 · 2 comments
Labels

Comments

@mckomo
Copy link

mckomo commented Aug 2, 2017

I have an issue during rollback on multiple host setup with restoring assets manifest. Currently restoring manifest works like this. It checks manifest name in assets_manifest_backup dir on one host and then uses this name to check again (assets.rake#L93) on each host if this manifest exists before copying archived manifest to public/assets dir.
This strategy fails when each host have different manifest (I know it's very unusual) and throws Capistrano::FileNotFound error (assets.rake#L98).

I propose we should detect manifest name per host.

System configuration

Ruby 2.4.1
capistrano (3.8.2)
capistrano-bundler (1.2.0)
capistrano-passenger (0.2.0)
capistrano-rails (1.2.3)
rails (4.2.9)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.8)
rails-html-sanitizer (1.0.3)
rake (12.0.0)
rspec-rails (3.6.0)
rvm1-capistrano3 (1.4.0)
sass-rails (5.0.6)
sequel-rails (0.9.17)
sprockets-rails (3.2.0)

@mattbrictson
Copy link
Member

Hi! Thanks for the bug report. Is this still a problem for you?

I am looking at the source code you referenced (see below), and it seems to me that manifest detection happens inside the on block, and therefore it is executed per host. I am not seeing the place in the code where the name detected on one host is applied to other hosts. Can you clarify?

task :restore_manifest do
on release_roles(fetch(:assets_roles)) do
within release_path do
target = detect_manifest_path
source = release_path.join('assets_manifest_backup', File.basename(target))
if test "[[ -f #{source} && -f #{target} ]]"
execute :cp, source, target
else
msg = 'Rails assets manifest file (or backup file) not found.'
warn msg
fail Capistrano::FileNotFound, msg
end
end
end
end

@AndreVolpi
Copy link

Probably this problem is similar to the one I just had, due to detect_manifest_path listing all manifests separated by space, if you have more than one (like we did here by mistake) the target variable becomes something like: path1 path2 and it breaks the test function (because it becomes [[ -f path1 && -f path2 path3]], imo the return from detect_manifest_path should be different in case there is more than one.

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