Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- #require File.dirname(__FILE__) + '/../../lib/nanite'
- require 'rubygems'
- require 'eventmachine'
- require 'nanite'
- require 'chef'
- require 'json'
- EM.run do
- Nanite.start_mapper(:host => 'localhost', :user => 'nanite', :pass => 'testing', :vhost => '/nanite', :log_level => 'debug')
- resource = Chef::Resource::Package.new('telnet')
- resource.action('install')
- resource.provider(Chef::Provider::Package::Yum)
- payload = { :resource => resource }
- # sfdchef01 is the chef server
- # sfdchef02 is the client which is running this script and the agent on port 8000
- server_name = 'sfdchef02.monster.com'
- EM.add_timer(16) do
- # Seems to hang after it gets inside the EM loop on the nanite request below
- r = Nanite.mapper.request('/control/resource', payload, :target => server_name) do |response_full|
- # Never gets here.
- EM.stop_event_loop
- end
- end
- end
Add Comment
Please, Sign In to add comment