Hi,
Yeah, I ran into the same problem. The trouble is that `rake install`, while moving the new roles into place, doesn't update the couchdb database, which is what the chef server actually uses as its backing store. I've got a pair of rake tasks that are now run on `rake install` that update the metadata *and* sync with the running Chef server:
namespace :roles do desc "Build roles from roles/role_name.json from role_name.rb" task :generate do chef_files.roles.each do |role_file| short_name = File.basename(role_file, '.rb') puts "Generating role JSON for #{short_name}" role = Chef::Role.new role.from_file(role_file) File.open(File.join(TOPDIR, 'roles', "#{short_name}.json"), "w") do |f| f.write(JSON.pretty_generate(role)) end end end
desc "Push the current set of roles in the filesystem into CouchDB" task :push => [ :generate ] do Chef::Role.sync_from_disk_to_couchdb end end
I blatantly stole these from somebody else, so credit it due elsewhere (but I can't remember where I found it, somewhere in Jira, I think?). The roles:generate task is just the same as the current roles task (which I've refactored slightly in our repo). The extra task is the roles:push which syncs them to couchdb.
Works a treat for me.
Cheers,
Graeme.
On 4 Aug 2009, at 11:08, Jose Luis Gordo Romero wrote: Hi!
I have a problem with chef 0.7.4, I create/modify roles and run rake install on chef server (seems updated correctly):
ubuntu.json 362 100% 353.52kB/s 0:00:00 (xfer#2, to-check=5/8)
ubuntu.rb 279 100% 272.46kB/s 0:00:00 (xfer#3, to-check=4/8) webserverbase.json 420 100% 410.16kB/s 0:00:00 (xfer#4, to-check=3/8) webserverbase.rb 326 100% 318.36kB/s 0:00:00 (xfer#5, to-check=2/8)
webserverphp.json 272 100% 265.62kB/s 0:00:00 (xfer#6, to-check=1/8) webserverphp.rb 258 100% 251.95kB/s 0:00:00 (xfer#7, to-check=0/8)
But in the webui (or directly on the couchdb database) is not appearing and can't be used by chef-client. Sometimes restarting the couchdb or apache (I can't reproduce the behaviour), it's appears.
Have you seen the same?
Many thanks in advance. Jose Luis Gordo
|