Openshift rhc port forward exception - ruby

I am trying to open ports so i access my database remotely from my pc
I am running on Ruby200-x64 and when i try to access port forward
rhc port-forward -a appname
i get the following response/error:
Checking available ports ... C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/pageant.rb:176:in `malloc': bignum too big to convert into `long' (RangeError)
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/pageant.rb:176:in `malloc_ptr'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/pageant.rb:240:in `get_token_information'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/pageant.rb:213:in `get_current_user'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/pageant.rb:189:in `get_security_attributes_for_user'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/pageant.rb:332:in `send_query'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/pageant.rb:309:in `send'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/agent/socket.rb:148:in `send_packet'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/agent/socket.rb:165:in `send_and_wait'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/agent/socket.rb:76:in `negotiate!'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/agent/socket.rb:48:in `connect'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/key_manager.rb:179:in `agent'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/key_manager.rb:103:in `each_identity'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/methods/publickey.rb:19:in `authenticate'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/session.rb:79:in `block in authenticate'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/session.rb:66:in `each'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh/authentication/session.rb:66:in `authenticate'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.9.2/lib/net/ssh.rb:211:in `start'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.38.4/lib/rhc/commands/port_forward.rb:86:in `run'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.38.4/lib/rhc/commands.rb:294:in `execute'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.38.4/lib/rhc/commands.rb:285:in `block (3 levels) in to_commander'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.38.4/lib/rhc/command_runner.rb:72:in `run!'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.38.4/lib/rhc/cli.rb:37:in `start'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.38.4/bin/rhc:20:in `<top (required)>'
from C:/Ruby200-x64/bin/rhc:23:in `load'
from C:/Ruby200-x64/bin/rhc:23:in `<main>'

It's a bit late but maybe it can help to newcomer.
The solution is, or better say- workaround, to exit the pageant while you port-forward the app. And when done turn it on again if you need to ssh to it.

I found a sort of workaround too, whenever i recieve this error i do the oldest trick in the books, a restart and it works all the times(for now)

Related

Ruby, Net-SSH: connection closed by remote host

Issue where SSH session gets disconnected after less than 1 sec by remote when using ruby net-ssh. It happens very randomly.
/home/admin/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.2/lib/net/ssh/transport/packet_stream.rb:89:in `next_packet': connection closed by remote host (Net::SSH::Disconnect)
from /home/admin/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:183:in `block in poll_message'
from /home/admin/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:178:in `loop'
from /home/admin/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:178:in `poll_message'
from /home/admin/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:461:in `dispatch_incoming_packets'
from /home/admin/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:222:in `preprocess'
from /home/admin/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:206:in `process'
from /home/admin/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `block in loop'
from /home/admin/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `loop'
from /home/admin/.rvm/gems/ruby-2.1.3/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `loop'
from /home/user/ruby/cisco/ssh.rb:43:in `run'
from /home/user/ruby/cisco/base.rb:48:in `run'
from rssh.rb:11:in `<main>'
Already tried specifying timeout settings and encryption algorithms.
Solution at https://github.com/net-ssh/net-ssh/issues/93 does not fix the issue

chef-shell --solo Chef::Exceptions::PrivateKeyMissing

I am building a recipe where I'm trying to debug how the attributes are being set, but when I execute chef-shell it gives me errors about missing /etc/chef/client.pem, from what I can tell those are generated by chef server, as I'm running in --solo mode shouldn't it skip the requirement for such things? Or am I using chef-shell improperly?
chef-shell --solo -c debug/solo.rb -j debug/nodes.json
loading configuration: debug/solo.rb
Session type: solo
Loading...done.
This is the chef-shell.
Chef Version: 11.14.6
http://www.opscode.com/chef
http://docs.opscode.com/
run `help' for help, `exit' or ^D to quit.
Ohai2u bob#MSIGS70stealth.thalhalla.net!
chef > roles.all
[2014-11-10T13:15:08-06:00] WARN: Failed to read the private key /etc/chef/client.pem: #<Errno::ENOENT: No such file or directory # rb_sysopen - /etc/chef/client.pem>
Chef::Exceptions::PrivateKeyMissing: I cannot read /etc/chef/client.pem, which you told me to use to sign requests!
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/http/authenticator.rb:78:in `rescue in load_signing_key'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/http/authenticator.rb:68:in `load_signing_key'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/http/authenticator.rb:38:in `initialize'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/rest.rb:66:in `new'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/rest.rb:66:in `initialize'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/search/query.rb:34:in `new'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/search/query.rb:34:in `initialize'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/role.rb:184:in `new'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/role.rb:184:in `list'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/shell/model_wrapper.rb:82:in `list_objects'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/shell/model_wrapper.rb:50:in `all'
from (irb):1
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/shell.rb:75:in `block in start'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/shell.rb:74:in `catch'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/lib/chef/shell.rb:74:in `start'
from /home/bob/.rvm/gems/ruby-2.1.0/gems/chef-11.14.6/bin/chef-shell:37:in `<top (required)>'
from /home/bob/.rvm/gems/ruby-2.1.0/bin/chef-shell:23:in `load'
from /home/bob/.rvm/gems/ruby-2.1.0/bin/chef-shell:23:in `<main>'
from /home/bob/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks2.1:15:in `eval'
from /home/bob/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks2.1:15:in `<main>'chef >
That method just isn't supported in solo mode. You can see in the code that is just calls either search or chef_server_rest directly.

Sinatra error - continuation called across threads

I am completely new to Ruby so my question may have quite a simple answer. However, I couldn't find an answer on stackoverflow.
I have the following very simple Sinatra app:
# myapp.rb
require 'rubygems'
require 'sinatra'
require 'json'
range=(199..2000).step(1)
set :port, 8888
get '/hostname' do
content_type :json
return range.next.to_json
end
Sinatra is starting:
ruby testsinatra.rb
== Sinatra/1.0 has taken the stage on 8888 for development with backup from WEBrick
[2014-09-11 08:43:18] INFO WEBrick 1.3.1
[2014-09-11 08:43:18] INFO ruby 1.8.7 (2011-06-30) [x86_64-linux]
[2014-09-11 08:43:18] INFO WEBrick::HTTPServer#start: pid=8215 port=8888
and serving first request:
curl -ks http://localhost:8888/hostname
199
but failing with an error at the second request:
RuntimeError - continuation called across threads:
/usr/lib/ruby/1.8/generator.rb:131:in `call'
/usr/lib/ruby/1.8/generator.rb:131:in `next'
/usr/lib/ruby/1.8/generator.rb:189:in `next'
testsinatra.rb:30:in `GET /hostname'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:863:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:863:in `route'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `route_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:500:in `route!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `catch'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `route!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `each'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `route!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:601:in `dispatch!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `catch'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:399:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.5.2/lib/rack/showexceptions.rb:24:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.5.2/lib/rack/commonlogger.rb:33:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:1003:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:1003:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/gems/1.8/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:946:in `run!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/main.rb:25
testsinatra.rb:27
Clearly, I'm missing something basic. Please advice.
Testing the code gives:
FiberError at /hostname
fiber called across threads
You can find a related question here: Sharing an enumerator across threads . It seems that the Fiber code stores the ID of the first thread that made an access to the object, and immediately fails when another thread tries to do so. You apparently just can't share enumerators between threads, and must resort to different means.
Please also note that global variables might be accessed simultaneously by different threads and you should always use thread-safe objects or explicit locking.

when i do knife cookbook upload 'cookbookname'

knife cookbook upload 'cookbookname'
i am getting the following error.
ubuntu#mychefclient:~/chef-repo$ knife cookbook upload redis
Uploading redis [0.1.0]
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:763:in `initialize': getaddrinfo: Temporary failure in name resolution (SocketError)
from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:763:in `open'
from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:763:in `block in connect'
from /opt/chef/embedded/lib/ruby/1.9.1/timeout.rb:69:in `timeout'
from /opt/chef/embedded/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:763:in `connect'
from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:745:in `start'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/resource.rb:76:in `put'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/cookbook_uploader.rb:151:in `block in uploader_function_for'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/cookbook_uploader.rb:25:in `call'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/cookbook_uploader.rb:25:in `block (3 levels) in setup_worker_threads'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/cookbook_uploader.rb:24:in `loop'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/cookbook_uploader.rb:24:in `block (2 levels) in setup_worker_threads'
This is happening because knife cannot access the Chef Server. Please ensure you can access the server (try pinging and telneting). It is most likely a local network issue.

Jumpstart Labs MicroBlogger unable to connect

I'm following the Jumpstart Labs MicroBlogger tutorial and I'm running into an issue where I'm unable to connect to twitter. I am getting the following errors:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Twitter::Error::ClientError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799:in `connect'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:744:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1284:in `request'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/adapter/net_http.rb:75:in `perform_request'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/adapter/net_http.rb:38:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:8:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:8:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:8:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/request/url_encoded.rb:14:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/request/multipart.rb:13:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/request/multipart_with_file.rb:14:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/connection.rb:253:in `run_request'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/connection.rb:118:in `post'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:108:in `request'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:72:in `post'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/api/utils.rb:82:in `object_from_response'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/api/tweets.rb:129:in `update'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jumpstart_auth-0.3.0/lib/jumpstart_auth.rb:32:in `update'
from C:/Users/Steve/RubymineProjects/MicroBlogger/micro_blogger.rb:12:in `tweet'
from C:/Users/Steve/RubymineProjects/MicroBlogger/micro_blogger.rb:18:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
This is my code so far:
require 'jumpstart_auth'
class MicroBlogger
attr_reader :client
def initialize
puts "Initializing"
#client = JumpstartAuth.twitter
end
def tweet(message)
#client.update(message)
end
end
blogger = MicroBlogger.new
blogger.tweet("hey")
As indicated in the error message, the SSL library couldn't verify the SSL certificate returned from the Twitter server. In this case, it is most likely because no certificate authorities were installed for you.
The details and solution are available here:
https://gist.github.com/fnichol/867550#file-readme-md
I suggest using the "boring" method, since it does not involve running code copied off the internet (instructions in case the link disappears, but better to read info at link):
Download http://curl.haxx.se/ca/cacert.pem
Save it to somewhere like C:\RailsInstaller\cacert.pem
Run set SSL_CERT_FILE=C:\RailsInstaller\cacert.pem to set the location for the current shell
Run your script in the same shell
If you have installed ruby directly to windows you can copy the cacert.pem file to the Ruby200dir(eg. c:\ruby200) and run the set SSL_CERT_FILE=[path to the cert file] command from the command prompt.
Keep in mind that this will require you to add the SSL cert for every boot of your computer

Resources