Problem with roles not updating


#1

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


#2

Yo!

On 4/08/2009, at 10:08 PM, 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.

The chef server currently requires a restart to pick up new roles via
rake install. If you’re running Chef under Passenger, this means
Apache should be restarted.

I’ve been thinking of hooking into Merb’s file watching behaviour to
have it reload cookbooks and roles automatically - what do you think?

Have you seen the same?

Many thanks in advance.
Jose Luis Gordo


AJ Christensen, Software Engineer
Opscode, Inc.
E: aj@opscode.com


#3

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.name(short_name)
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


#4

On 4 Aug 2009, at 11:18, Arjuna Christensen wrote:

I’ve been thinking of hooking into Merb’s file watching behaviour to
have it reload cookbooks and roles automatically - what do you think?

That would be awesome, yes. For inexperienced users (ie me!) there’s a
frustrating stumbling point when what you’ve just pushed to the
running chef server doesn’t match what’s actually being served up.

G


#5

Sounds good the two solutions, the main concern with the current aproach is
the need of restart the prod chef server behind chef-clients runs!

Thanks!
Jose Luis Gordo

2009/8/4 Graeme Mathieson mathie@woss.name

On 4 Aug 2009, at 11:18, Arjuna Christensen wrote:

I’ve been thinking of hooking into Merb’s file watching behaviour to have

it reload cookbooks and roles automatically - what do you think?

That would be awesome, yes. For inexperienced users (ie me!) there’s a
frustrating stumbling point when what you’ve just pushed to the running chef
server doesn’t match what’s actually being served up.

G