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

Capistrano::FileNotFound: Rails assets manifest file not found when using --print-config-variables option #223

Open
bikramwp opened this issue Jul 18, 2018 · 0 comments

Comments

@bikramwp
Copy link

bikramwp commented Jul 18, 2018

Steps to reproduce

Do a cold deploy (where the <app>/current path does not exist).
Deploy with cap --print-config-variables deploy

Expected behavior

The assets_manifest file should be copied from the current release_path <app>/releases/20180718040802/public/assets/.sprockets-manifest-abcd to <app>/releases/20180718040802/assets_manifest_backup/.sprockets-manifest-abcd.

See in the error trace below: ls: cannot access '/home/deploy-user/test-app/current/public/assets/.sprockets-manifest*': No such file or directory

Since the /current path does not yet exist, the backup fails. Maybe(?) the /current should not be getting used at all for the backup and instead it should be the release_path that should be used at all times?

Actual behavior

An error is thrown:

      WARN  Rails assets manifest file not found.
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: Rails assets manifest file not found.

Caused by:
Capistrano::FileNotFound: Rails assets manifest file not found.

Tasks: TOP => deploy:assets:backup_manifest
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as [email protected]: Rails assets manifest file not found.

** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:

 DEBUG [35002d68] Finished in 0.101 seconds with exit status 0 (successful).
  INFO [16952ff6] Running /usr/bin/env mkdir -p /home/deploy-user/test-app/releases/20180718040802/assets_manifest_backup as [email protected]
 DEBUG [16952ff6] Command: cd /home/deploy-user/test-app/releases/20180718040802 && /usr/bin/env mkdir -p /home/deploy-user/test-app/releases/20180718040802/assets_manifest_backup
  INFO [eeef99ea] Finished in 0.103 seconds with exit status 0 (successful).
 DEBUG [c149607f] Running /usr/bin/env ls /home/deploy-user/test-app/current/public/assets/.sprockets-manifest* as [email protected]
 DEBUG [c149607f] Command: cd /home/deploy-user/test-app/releases/20180718040802 && /usr/bin/env ls /home/deploy-user/test-app/current/public/assets/.sprockets-manifest*
  INFO [502f9b11] Finished in 0.101 seconds with exit status 0 (successful).
 DEBUG [a569bd45] Running /usr/bin/env ls /home/deploy-user/test-app/current/public/assets/.sprockets-manifest* as [email protected]
 DEBUG [a569bd45] Command: cd /home/deploy-user/test-app/releases/20180718040802 && /usr/bin/env ls /home/deploy-user/test-app/current/public/assets/.sprockets-manifest*
 DEBUG [2f0f2f0c]   ls: cannot access '/home/deploy-user/test-app/current/public/assets/.sprockets-manifest*': No such file or directory
 DEBUG [2f0f2f0c] Finished in 0.105 seconds with exit status 2 (failed).
 DEBUG [e28e7923] Running /usr/bin/env ls /home/deploy-user/test-app/current/public/assets/manifest*.* as [email protected]
 DEBUG [e28e7923] Command: cd /home/deploy-user/test-app/releases/20180718040802 && /usr/bin/env ls /home/deploy-user/test-app/current/public/assets/manifest*.*
 DEBUG [924d8181]   ls: cannot access '/home/deploy-user/test-app/current/public/assets/.sprockets-manifest*': No such file or directory
 DEBUG [924d8181] Finished in 0.112 seconds with exit status 2 (failed).
 DEBUG [8b58a53b] Running /usr/bin/env ls /home/deploy-user/test-app/current/public/assets/manifest*.* as [email protected]
 DEBUG [8b58a53b] Command: cd /home/deploy-user/test-app/releases/20180718040802 && /usr/bin/env ls /home/deploy-user/test-app/current/public/assets/manifest*.*
 DEBUG [d9b7d0fe]   ls: cannot access '/home/deploy-user/test-app/current/public/assets/manifest*.*': No such file or directory
 DEBUG [d9b7d0fe] Finished in 0.105 seconds with exit status 2 (failed).
  WARN Rails assets manifest file not found.

Possible Fix?

diff --git i/lib/capistrano/tasks/assets.rake w/lib/capistrano/tasks/assets.rake
index f01a62f..de30734 100644
--- i/lib/capistrano/tasks/assets.rake
+++ w/lib/capistrano/tasks/assets.rake
@@ -101,8 +101,14 @@ namespace :deploy do
       end
     end
 
+    def assets_manifests_path
+      fetch(:assets_manifests).map do |pattern|
+        release_path.join("public", fetch(:assets_prefix), pattern)
+      end
+    end
+
     def detect_manifest_path
-      fetch(:assets_manifests).each do |candidate|
+      assets_manifests_path.each do |candidate|
         return capture(:ls, candidate).strip.gsub(/(\r|\n)/, ' ') if test(:ls, candidate)
       end
       msg = 'Rails assets manifest file not found.'
@@ -130,10 +136,6 @@ namespace :load do
   task :defaults do
     set :assets_roles, fetch(:assets_roles, [:web])
     set :assets_prefix, fetch(:assets_prefix, 'assets')
-    set :assets_manifests, -> {
-      %w[.sprockets-manifest* manifest*.*].map do |pattern|
-        release_path.join("public", fetch(:assets_prefix), pattern)
-      end
-    }
+    set :assets_manifests, %w[.sprockets-manifest* manifest*.*]
   end
 end
@bikramwp bikramwp changed the title Capistrano::FileNotFound: Rails assets manifest file not found Capistrano::FileNotFound: Rails assets manifest file not found when using --print-config-variables option Jul 18, 2018
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

No branches or pull requests

1 participant