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

Make config template configurable #153

Closed
maikihde opened this issue Oct 28, 2013 · 9 comments
Closed

Make config template configurable #153

maikihde opened this issue Oct 28, 2013 · 9 comments

Comments

@maikihde
Copy link

Hi,
it would would be really cool, if the template that creates the logging.yml (and maybe others) could be made configurable, so that an application cookbook could set attributes to override the template file and instead "plug" in it's own template. Similarly as it is done in the varnish cookbook:

template "#{node['varnish']['dir']}/#{node['varnish']['vcl_conf']}" do
  source node['varnish']['vcl_source']
  if node['varnish']['vcl_cookbook']
    cookbook node['varnish']['vcl_cookbook']
  end
...
end

Kind Regards,
Maik

@karmi
Copy link
Contributor

karmi commented Oct 28, 2013

Why not use the common “wrapper cookbook” approach instead? https://github.com/elasticsearch/cookbook-elasticsearch#customizing-the-cookbook.

I don't feel very well about having dozens of configurable node attributes in general...

@maikihde
Copy link
Author

I prefer to use attributes in such a case, so you can override settings easier in the wrapper cookbook. I have done as described above, but it feels a bit dangerous, because if the name of that template resource changes, it is going to fail...

@karmi
Copy link
Contributor

karmi commented Oct 28, 2013

If the name of the template would change like that, I guess you'd have to check many other things :)

I don't think the goal should be "I don't care about cookbook" changes, but to facilitate configuration & customization. This is a goal I take seriously.

On 28. 10. 2013, at 13:13, maikihde notifications@github.com wrote:

I prefer to use attributes in such a case, so you can override settings easier in the wrapper cookbook. I have done as described above, but it feels a bit dangerous, because if the name of that template resource changes, it is going to fail...


Reply to this email directly or view it on GitHub.

@neovatar
Copy link

+1 for this feature request!

I also need to configure the logging in a way that I cannot do it with the provided template. While its possible to do it with resource manipulation like you describe in your documentation, it still feels a lot like monkey patching and not like using a library(-cookbook). Logging will probably be one of more heavily customized thinks in an specific environment, so an additional attribute maybe well justified.

If you consider adding this functionality, I can offer to work on it and send a pull request.

@karmi
Copy link
Contributor

karmi commented Feb 3, 2014

@maikihde @neovatar Agreed that it could help in some scenarios. Though, given the myriad of ways you can accomplish something in Chef, what is the exact usage pattern here? Can you elaborate?

1/ User uses this cookbook as is
2/ User has an application cookbook
3/ The application cookbook changes value of some node.elasticsearch.configuration_template attribute?
4/ The cookbook picks up this attribute?
5/ Where do you store the custom template? In the application cookbook?

@maikihde
Copy link
Author

maikihde commented Feb 4, 2014

1/ yes, I try hard to not fork cookbooks if not absolutely neccessary
2/ definetely yes :)
3/ yes, it would change some attribute
4/ yes the library cookbook picks up the attribute and looks for
5/ the template (is) in the application cookbook

Hope this clears it up.

@karmi
Copy link
Contributor

karmi commented Mar 10, 2014

@maikihde Sorry, the issue slipped by. There's a discussion about something similar in #186 now, I think we should have this support for the brave people.

I'm no Lisp fanboi, but I shudder a bit when I think about the application cookbook changing the attribute of the elasticsearch cookbook :) I would really advice to research the "wrapper cookbook" pattern.

@karmi karmi closed this as completed in 1b3be69 Jun 18, 2014
@karmi
Copy link
Contributor

karmi commented Jun 18, 2014

Hi, add some patch which should implement the feature, can you have a look? Thanks!

@karmi karmi removed the waiting label Jun 18, 2014
@maikihde
Copy link
Author

maikihde commented Jul 1, 2014

Looks good for me, thanks!

Maik


Von: Karel Minarik [notifications@github.com]
Gesendet: Mittwoch, 18. Juni 2014 18:10
An: elasticsearch/cookbook-elasticsearch
Cc: Ihde, Maik
Betreff: Re: [cookbook-elasticsearch] Make config template configurable (#153)

Hi, add some patch which should implement the feature, can you have a look? Thanks!


Reply to this email directly or view it on GitHubhttps://github.com//issues/153#issuecomment-46457118.

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

3 participants