Showing posts with label automation. Show all posts
Showing posts with label automation. Show all posts

Tuesday, May 7, 2013

New Cookbook: Watcher

I have finally managed to publish my first open source contribution: a Chef cookbook that installs and configures the Python Watcher daemon, written by Greggory Hernandez. The tool itself uses the Linux kernel inotify subsystem to catch file system events such file creation, deletion, etc. and perform an arbitrary action.

The cookbook can be found on GitHub and is still in it's infancy. There are a couple of features I'll be working on next:

  • Currently only supports RHEL and CentOS, but I have a need for this to work on a Debian-based system, so I should add this shortly.
  • The job LWRP can only currently add new jobs to a server, but I'd like to be able to delete and/or disable them.

Hopefully over the coming weeks, I'll be able to add to the cookbook and flesh it out accordingly: feedback and contributions are welcome!

Friday, March 1, 2013

Knife Bootstrap Failure - no such file to load -- rubygems/format (LoadError)

I just experienced an issue when trying to bootstrap a new Chef node in EC2 using the "knife ec2 server create" command. Everything seemed to be proceeding normally, until the actual node attempted to run Chef to register with the server; instead I was greeted with the following error:

/usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `gem_original_require': no such file to load -- rubygems/format (LoadError)
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `require'
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib64/ruby/gems/1.8/gems/chef-10.24.0/bin/../lib/chef/provider/package/rubygems.rb:34
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `gem_original_require'
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `require'
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib64/ruby/gems/1.8/gems/chef-10.24.0/bin/../lib/chef/providers.rb:60
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `gem_original_require'
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `require'
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib64/ruby/gems/1.8/gems/chef-10.24.0/bin/../lib/chef.rb:25
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `gem_original_require'
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `require'
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/lib64/ruby/gems/1.8/gems/chef-10.24.0/bin/chef-client:23
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/bin/chef-client:23:in `load'
ec2-54-228-10-198.eu-west-1.compute.amazonaws.com from /usr/bin/chef-client:23

I tried modifying my bootstrap template (thanks to Steven Danna, of Opscode for providing a CentOS 6 template!) to force the installation of the format gem, but the problem persisted. A quick search online brought up a topic of discussion on the Chef mailing list that seemed to blame the latest release of RubyGems (2.0). The suggested workaround was to downgrade the RubyGems install to the previous release; 1.8.25. To ensure that I would be able to bootstrap machines without a manual intervention, I opened up the relevant template (residing in ~/.rvm/gems/ruby-1.9.3-p385/gems/chef-10.24.0/lib/chef/knife/bootstrap/centos6-gems.erb) and changed line 15 from:

gem update --system

To the following:

gem update --system 1.8.25

This allowed my EC2 instantiation to complete successfully! I'm sure Opscode will release an update to fix this issue shortly, but hopefully this will help a few people in the meantime. Now to debug some outstanding issues with my cookbooks...