You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are lots of cases out there of users confused by cases of Capistrano apparently failing to find a version of Ruby that was installed with rbenv. In such cases we see output like this:
$ bundle exec cap staging deploy
00:00 rbenv:validate
WARN rbenv: 3.1.2 is not installed or not found in $HOME/.rbenv/versions/3.1.2 on 123.123.123.123
I was recently baffled by a case like this, because I knew for sure that this version of Ruby was installed in the specified location, and I hadn't changed anything.
It turned out that the underlying problem was simply that Capistrano was unable to log into the server, because the relevant user's password had expired and needed to be changed.
I would have been saved a lot of head scratching if the output from the rbenv:validate command had reflected this problem rather than seeming to imply that it had connected to the server in question but found Ruby absent at the specified path.
The text was updated successfully, but these errors were encountered:
I think the underlying issue here is that rbenv:validate uses the test method, which simply returns true or false depending on whether the command succeeds, without printing any output. So when a command fails for unexpected reasons, like:
because the relevant user's password had expired and needed to be changed
A simple solution might be to override the verbosity option used by test so that at least the underlying output from the command can be seen.
--- lib/capistrano/tasks/rbenv.rake+++ lib/capistrano/tasks/rbenv.rake@@ -7,7 +7,7 @@ namespace :rbenv do
end
# don't check the rbenv_ruby_dir if :rbenv_ruby is not set (it will always fail)
- unless rbenv_ruby.nil? || (test "[ -d #{fetch(:rbenv_ruby_dir)} ]")+ unless rbenv_ruby.nil? || (test("[ -d #{fetch(:rbenv_ruby_dir)} ]", verbosity: Logger::INFO))
warn "rbenv: #{rbenv_ruby} is not installed or not found in #{fetch(:rbenv_ruby_dir)} on #{host}"
exit 1
end
That said, I don't actually use this gem, so I don't feel comfortable making this change without being able to test it.
I'll put a help wanted label on this issue for now.
There are lots of cases out there of users confused by cases of Capistrano apparently failing to find a version of Ruby that was installed with rbenv. In such cases we see output like this:
I was recently baffled by a case like this, because I knew for sure that this version of Ruby was installed in the specified location, and I hadn't changed anything.
It turned out that the underlying problem was simply that Capistrano was unable to log into the server, because the relevant user's password had expired and needed to be changed.
I would have been saved a lot of head scratching if the output from the rbenv:validate command had reflected this problem rather than seeming to imply that it had connected to the server in question but found Ruby absent at the specified path.
The text was updated successfully, but these errors were encountered: