user1063287 user1063287 - 4 months ago 16
Ruby Question

rhc setup returns "warning: constant ::TimeoutError is deprecated"

Environment


  • Ubuntu 16.04 xenial

  • Linux Kernel: 4.4.0-22-generic

  • ruby --version



ruby 2.3.0p0 (2015-12-25) [x86_64-linux-gnu]


Steps to replicate

sudo apt-get install ruby-full
rhc setup


returns:


/var/lib/gems/2.3.0/gems/commander-4.2.1/lib/commander/user_interaction.rb:328:
warning: constant ::TimeoutError is deprecated


After uploading
default
public key, it shows:


Checking for git ... found git version 2.7.4

Checking common problems
./var/lib/gems/2.3.0/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:67:in
initialize': Object#timeout is deprecated, use Timeout.timeout
instead.
/var/lib/gems/2.3.0/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in
initialize': Object#timeout is deprecated, use Timeout.timeout
instead. . done


When running:

rhc --help


It returns:


/var/lib/gems/2.3.0/gems/commander-4.2.1/lib/commander/user_interaction.rb:328:
warning: constant ::TimeoutError is deprecated

Answer

It looks like a gem uses Object#timeout under the hood, which is deprecated. It's recommended to now use Timeout.timeout, like the error says.

As far as what you should do - this is just a deprecation warning, not an error, so probably nothing is broken.

If the warning is really bothering you, you could edit the gem source at /var/lib/gems/2.3.0/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb and replace the timeout calls with Timeout.timeout (or fork the gem and make the same changes). The author might appreciate a pull request, if you're eager. But I personally wouldn't worry about this.