Skip to content

Instantly share code, notes, and snippets.

@cwjohnston
Created May 12, 2010 17:23
Show Gist options
  • Save cwjohnston/398854 to your computer and use it in GitHub Desktop.
Save cwjohnston/398854 to your computer and use it in GitHub Desktop.
include_recipe "pbuilder"
%w{ python-cheetah python-yaml git-core }.each do |pkg|
package pkg do
action :install
end
end
git "/usr/src/cobbler" do
#repository "git://git.fedoraproject.org/git/cobbler/"
repository "git://github.com/Farzy/cobbler.git" # this repository has a new module with preliminary support for chef
revision "chef"
action :sync
end
# find the latest deb in /var/cache/pbuilder/result and stuff it in cobblerpkg
Dir.entries("/var/cache/pbuilder/result").each do |filename|
if File.fnmatch?("*cobbler_*_all.deb",filename)
cobblerpkg = filename
log "cobblerpkg contains #{cobblerpkg}"
end
end
dpkg_package "cobbler" do
source "/var/cache/pbuilder/result/#{cobblerpkg}"
action :nothing
end
bash "build cobbler packages" do
cwd "/usr/src/cobbler"
code <<-EOH
pdebuild
EOH
not_if { Dir["/var/cache/pbuilder/result/cobbler_*_all.deb"][0] } # modify this to see if a version is already installed via dpkg
notifies :install, resources(:dpkg_package => "cobbler"), :immediately
end
[Wed, 12 May 2010 02:19:55 +0000] INFO: Starting Chef Run
[Wed, 12 May 2010 02:19:57 +0000] INFO: Storing updated cookbooks/cobbler/recipes/default.rb in the cache.
/usr/lib/ruby/1.8/chef/resource.rb:74:in `method_missing': undefined method `cobblerpkg' for Chef::Resource::DpkgPackage (NoMethodError)
from /var/cache/chef/cookbooks/cobbler/recipes/default.rb:44:in `from_file'
from /usr/lib/ruby/1.8/chef/mixin/recipe_definition_dsl_core.rb:73:in `instance_eval'
from /usr/lib/ruby/1.8/chef/mixin/recipe_definition_dsl_core.rb:73:in `method_missing'
from /var/cache/chef/cookbooks/cobbler/recipes/default.rb:43:in `from_file'
from /usr/lib/ruby/1.8/chef/cookbook.rb:171:in `load_recipe'
from /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:41:in `include_recipe'
from /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:26:in `each'
from /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:26:in `include_recipe'
from /usr/lib/ruby/1.8/chef/compile.rb:145:in `load_recipes'
from /usr/lib/ruby/1.8/chef/compile.rb:144:in `each'
from /usr/lib/ruby/1.8/chef/compile.rb:144:in `load_recipes'
from /usr/lib/ruby/1.8/chef/compile.rb:54:in `initialize'
from /usr/lib/ruby/1.8/chef/client.rb:329:in `new'
from /usr/lib/ruby/1.8/chef/client.rb:329:in `converge'
from /usr/lib/ruby/1.8/chef/client.rb:87:in `run'
from /usr/lib/ruby/1.8/chef/application/client.rb:215:in `run_application'
from /usr/lib/ruby/1.8/chef/application/client.rb:207:in `loop'
from /usr/lib/ruby/1.8/chef/application/client.rb:207:in `run_application'
from /usr/lib/ruby/1.8/chef/application.rb:62:in `run'
from /usr/bin/chef-client:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment