Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with nginx cookbook #46

Closed
austinche opened this issue Jan 11, 2013 · 5 comments
Closed

Conflict with nginx cookbook #46

austinche opened this issue Jan 11, 2013 · 5 comments

Comments

@austinche
Copy link

I'm using the opscode nginx cookbook and I'm not loading the elasticsearch nginx recipe. But just including the elasticsearch cookbook causes problems with the nginx cookbook. The problem is that in attributes/nginx.rb, it sets nginx user to 'nginx' which overrides the 'default' user of www-data set by the nginx cookbook. As the 'nginx' user doesn't exist and as I'm not loading the elasticsearch nginx recipe, that user does not get created.

Should the attributes be using 'set' instead of 'default'? I could not even set a normal attribute on the node, and had to create override attributes for nginx user/group to set it back to www-data. I don't know the best way to avoid conflict with multiple default attributes set across cookbooks. Would default_unless for the attributes make it not override the nginx cookbook defaults?

@karmi
Copy link
Contributor

karmi commented Jan 15, 2013

Hi, I nevery really wrapped my head around proper attribute setting in Chef, even after reading all available documentation and source code :) Node attributes should be over-rideable just by knife node edit, but the preferrable way is to use roles.

Could you try to change the attribute setting in the attributes/nginx.rb file to use the default[:nginx] notation, if it helps?

@austinche
Copy link
Author

Using default[:nginx] allows me to set a normal attribute using knife node edit. However, before this cookbook was pulled in as a dependency, I didn't need to set it at all. So it seems that the default[:nginx] in this cookbook overrides the default[:nginx] in the nginx cookbook. From the chef documentation, it appears to load cookbooks in alphabetical order. This cookbook is loaded first and it thus appears that the first 'default' attribute wins. It seems the simplest solution is to just copy from the nginx cookbook attributes/default.rb the platform specific block for setting the user. Then the two cookbooks would have the same defaults.

@karmi
Copy link
Contributor

karmi commented Jan 15, 2013

So it seems that the default[:nginx] in this cookbook overrides the default[:nginx] in the nginx cookbook.
This cookbook is loaded first and it thus appears that the first 'default' attribute wins.

Yes, that is how attributes in cookbooks work, unfortunately.

It seems the simplest solution is to just copy from the nginx cookbook attributes/default.rb the platform specific block for setting the user.

Yes, sounds like a good idea, will update it.

@karmi karmi closed this as completed in 76ce878 Jan 15, 2013
@karmi
Copy link
Contributor

karmi commented Jan 15, 2013

Should be fixed, verified to be running as "www-data" on Ubuntu, as "nginx" on CentOS.

@austinche
Copy link
Author

thanks! works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants