#chef

thedeeno can I set a value for node.run_state[<attribute>] before a chef run? I want to force the opscode nginx::source recipe to recompile and from the source it looks like setting node.run_state['nginx_force_recompile'] to true would do it. 04:24
thedeeno hmm, looking at the source a bit closer seems this wouldn't actually work if I could magically set this attribute before hand (it get's overwritten). Further, it seems run_state isn't supposed to be used that way 04:32
abstrusenick why the default chef users cookbook uses NOPASSWD for sudo? 09:55
zts abstrusenick: I don't think the "users" cookbook touches sudoers at all... 10:56
abstrusenick sorry 10:56
zts abstrusenick: but note that it doesn't set passwords either, which is why the readme suggests using NOPASSWD in the sudo template 10:56
abstrusenick yes it does not set the password 10:57
is it a good practice? 10:57
why do that? 10:57
zts I'm not sure, we've modified our local copy to manage passwords 10:58
abstrusenick how do you keep the password config? 10:59
zts If I had to guess, it's that you can't set passwords without the ruby-shadow gem installed, and maybe the author of the users cookbook didn't want to depend on that 10:59
We store the hash in the users databag 11:00
abstrusenick: http://tickets.opscode.com/browse/COOK-937 <- ticket requesting what you want, so maybe you can vote/comment to say that you'd like it too 11:04
abstrusenick ok thanks 11:05
some cookbooks use databags 11:05
but I'm only using chef solo 11:05
zts You can pass data bags to chef solo in recent versions: http://wiki.opscode.com/display/chef/Data+Bags#DataBags-UsingDataBagswithChefSolo 11:06
that won't help you if the recipe uses search to find data bags though, as search still won't work 11:07
It is pretty common to need to make changes to the cookbooks you're using, to suit your environment 11:08
I imagine that the reason the 'users' cookbook is missing obvious features is that each person customises it to suit their needs, and then it's no good for anyone else 11:10
abstrusenick i see 11:14
thanks 11:14
zts no problem 11:22
HasanB Hi neighbours. A newbie here with a little problem. :-( 12:19
I'm trying install the jenkins recipe on ubuntu, but I get "FATAL: Chef::Exceptions::Package: package[jenkins] (jenkins::default line 161) had an error: Chef::Exceptions::Package: No version specified, and no candidate version available for jenkins" 12:20
googling suggests the ERROR means that Chef::Exceptions::Package: can't get at the repo. But I do not know what to do about that. 12:22
Is this a well known error with chef installation ? One of those "Oh, looks like you skipped step xyz." kinds of mistakes ?? 12:25
HasanB I checked the file /var/lib/apt/lists/pkg.jenkins-ci.org_debian_binary_Packages and it definitely points to the latest version number 12:34
HasanB Ha! Well that sure is amusing --- it seems to have fixed itself. 12:41
HasanB but I ran --- sudo aptitude update --- !!! 12:49
Did I skip a step that would have told the apt recipe to update its knowledge of its own repositories? 12:50
thedeeno I'm confused by automatic_attrs. Can someone explain how chef is storing the attr ['nginx']['version'] for use in future runs here? https://github.com/opscode-cookbooks/nginx/blob/master/recipes/source.rb#L90 16:19
I suppose if it were part of the built in automatic attributes it'd make more sense to me, but I don't understand how this custom one is being stored 16:19
yfeldblum thedeeno, node attributes come in four "levels" - default, normal, override, and automatic; a datum in the normal-level attributes overrides the corresponding datum in the default-level attributes, and so on 16:56
thedeeno, automatic-level attributes are reserved for ohai: chef-solo & chef-client will run ohai fore running any recipes and store the results in the automatic-level attributes 16:56
thedeeno so in order for ohai to detect the nginx version a plugin was written? 16:57
an ohai plugin* 16:57
yfeldblum thedeeno, the opscode-cookbooks/nginx cookbook has an ohai plugin for nginx, which *sets* these attributes (again, at the automatic level) ... https://github.com/opscode-cookbooks/nginx/blob/master/templates/default/plugins/nginx.rb.erb#L20-21 16:59
https://github.com/opscode-cookbooks/nginx/blob/master/recipes/source.rb#L43 17:00
https://github.com/opscode-cookbooks/nginx/blob/master/recipes/ohai_plugin.rb 17:00
does that make any sense? 17:01
thedeeno I think I understand the loading and definiton of the plugin, but I don't understand how 'provides' is doing it's magic here https://github.com/opscode-cookbooks/nginx/blob/master/templates/default/plugins/nginx.rb.erb#L20-21 17:02
yfeldblum thedeeno, that's the ohai plugin API: #provides is a method provides by ohai for ohai plugins to call and provide data 17:03
thedeeno ah, cool. I'll chec that out thent 17:03
yfeldblum thedeeno, it's ohai internals 17:03
thedeeno thanks yfeldblum, you helped me through this barrier :) 17:04
yfeldblum thedeeno, no probs 17:04
thedeeno we'll see what I come up with 17:04
yfeldblum thedeeno, just curious, what overall are you trying to accomplish? 17:05
thedeeno it's morphing as I learn more... Currently I'm trying to add a phusion-passenger config flag to the nginx::source recipe. 17:06
hasn't worked out well so far. I extending node.run_state['nginx_config_flags'] like this https://github.com/opscode-cookbooks/nginx/blob/master/recipes/http_ssl_module.rb but that didn't appear to work 17:08
and since I'm new to chef, I'm not sure if I just messed something simple up or I'm just doing it wrong 17:08
:/ learnig curve... 17:09
then I wanted to force a recompile, and after looking through the source I saw these auto attributes which knew the previously used config flags and version number to prevent reduntant compiles 17:10
and that's where I am 17:10
hoover_damm heh 17:33
I refactored the nginx cookbook to supporting passenger for a client 17:33
gosh it was ugly 17:33
thedeeno, https://gist.github.com/92a8d6bcbdf08d334e34 17:35
thedeeno, fwiw request_start_variable.patch is actually from newrelic https://newrelic.com/docs/features/tracking-front-end-time 17:36
beyond that usage of the same pattern of attributes and it should just work 17:36
then proper usage of nginx app files is required 17:36
if you need examples lmk 17:36
xiaotian hi, I just discovered shef, but it doesn't seem to be work for me, I have a output here http://pastebin.com/K77h1q0y 18:15
I am trying to use recipe command 18:15
and include_recipe '<recipe>' 18:16
and it gives load_recipe of Nil class error. 18:16
ok, never mind, I forgot to pass -s (for chef-solo) option. 18:21