when i do knife cookbook upload 'cookbookname' - installation

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.

Related

Openshift rhc port forward exception

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)

"No connection could be made" to GitHub

I am trying to get this run to my test organization created on github.com, but got this error. Can anyone tell me what's wrong?
C:\Workspace\Ruby>set GITHUB_TOKEN=xxx
C:\Workspace\Ruby>set GITHUB_API_ENDPOINT=http://api.github.com
C:\Workspace\Ruby>ruby team_audit.rb HudsonsBay
C:/Tools/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:879:in `initialize': No connection could be made because the target machine actively refused it. - connect(2) for "api.github.com" port 80 (Faraday::Conn
ectionFailed)
from C:/Tools/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:879:in `open'
from C:/Tools/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:879:in `block in connect'
from C:/Tools/Ruby21-x64/lib/ruby/2.1.0/timeout.rb:75:in `timeout'
from C:/Tools/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:878:in `connect'
from C:/Tools/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
from C:/Tools/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:852:in `start'
from C:/Tools/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:1375:in `request'
from C:/Tools/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:1133:in `get'
from C:/Tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http
.rb:80:in `perform_request'
from C:/Tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http
.rb:40:in `block in call'
from C:/Tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/faraday-
C:\Workspace\Ruby>
I tried to make the same request and got the same error.
after changing the URL from http://api.github.com into https://api.github.com it working.

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

Error when running net/http in ruby via the terminal

Running a Net::HTTP post request in ruby. I am using the terminal in Ubuntu and receive this error message:
SocketError: getaddrinfo: Name or service not known
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `initialize'
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `open'
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
from /usr/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
from /usr/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `connect'
from /usr/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from /usr/lib/ruby/1.9.1/net/http.rb:744:in `start'
from /usr/lib/ruby/1.9.1/net/http.rb:1284:in `request'
from /usr/lib/ruby/1.9.1/net/http.rb:1307:in `send_entity'
from /usr/lib/ruby/1.9.1/net/http.rb:1096:in `post'
from (irb):356
from /usr/bin/irb:12:in `<main>'
Running the following code:
uri = ##url
http = Net::HTTP.new(uri)
response = http.post('/', ##str)
puts response
"Name or service not known" is a socket level error that is thrown when you cannot resolve a given domain name or are specifying an IP address that cannot be connected to. No other information will be available without posting the URL and string you are trying to post.

With Nokogiri i am getting error "initialize': getaddrinfo: No such host is known. (SocketError)"

I worte the below code, just to start the Nokogiri to mee the requirement and when I ran it for testing got the error:
D:\WIPData\Ruby\Scripts>Nokogiri.rb
C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `initialize': getaddrinfo: No such
host is known. (SocketError)
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `open'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `connect'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:306:in `open_http'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:775:in `buffer_open'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:203:in `block in open_loop'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:201:in `catch'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:201:in `open_loop'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:146:in `open_uri'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:677:in `open'
from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:33:in `open'
from D:/WIPData/Ruby/Scripts/Nokogiri.rb:6:in `<main>'
D:\WIPData\Ruby\Scripts>
CODE
require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML::Document for the page we’re interested in...
doc = Nokogiri::HTML(open('http://www.google.co.in'))
Why so and how to fix the same,please advice me.
It appears you need to configure a proxy. Find out what the proxy URL/Port is for your organization (and whether there needs to be authentication). You may be able to view this information from your browser configuration. In order to use it with your Ruby code, you need to set the HTTP_PROXY environment variable.
You can set it in Ruby code:
ENV['HTTP_PROXY'] = 'http://hostname:port'
or if you need authentication:
ENV['HTTP_PROXY'] = 'http://username:password#hostname:port'
A more permanent solution is to set HTTP_PROXY in your system environment variables.

Resources