Search code examples
ruby-on-railsrubyrakecapistranocapistrano3

Why capistrano 3 linked files aways fails on dry run?


When I run bundle exec cap production deploy:check:linked_files I got success but if I add --dry-run to test, it aways fails.

See the Outputs:

bundle exec cap production deploy:check:linked_files

DEBUG [c593caa5] Running /usr/bin/env [ -f /home/app/www/shared/config/database.yml ] as app@xxx.xxx.xxx.xxx
DEBUG [c593caa5] Command: [ -f /home/app/www/shared/config/database.yml ]
DEBUG [c593caa5] Finished in 3.206 seconds with exit status 0 (successful).
DEBUG [9619277e] Running /usr/bin/env [ -f /home/app/www/shared/config/mongoid.yml ] as app@xxx.xxx.xxx.xxx
DEBUG [9619277e] Command: [ -f /home/app/www/shared/config/mongoid.yml ]
DEBUG [9619277e] Finished in 0.304 seconds with exit status 0 (successful).

And with --dry-run:

bundle exec cap production deploy:check:linked_files --dry-run

DEBUG [26483ac3] Running /usr/bin/env [ -f /home/app/www/shared/config/database.yml ] as app@xxx.xxx.xxx.xxx
DEBUG [26483ac3] Command: [ -f /home/app/www/shared/config/database.yml ]
ERROR linked file /home/app/www/shared/config/database.yml does not exist on xxx.xxx.xxx.xxx

This is expected or its some kind of bug?


Solution

  • It is a bug due to how --dry-run works in Capistrano. During a dry run, all test commands return false. So Capistrano thinks the linked files do not exist, and it gives up.

    https://github.com/capistrano/capistrano/issues/1565