sous-chefs / haproxy

Development repository for the haproxy cookbook
https://supermarket.chef.io/cookbooks/haproxy
Apache License 2.0
158 stars 250 forks source link

HAProxy init script does not work when HAProxy is installed from source package #66

Closed nitinmohan87 closed 10 years ago

nitinmohan87 commented 10 years ago

In the install_source recipe, the haproxy configuration directory is set to /usr/local//etc/haproxy/haproxy.cfg which does not make sense. The bug is here in this line - https://github.com/hw-cookbooks/haproxy/blob/master/recipes/install_source.rb#L34

In the attributes file node['haproxy']['source']['prefix'] is set to /usr/local node['haproxy']['conf_dir'] is set to /etc/haproxy

Hence the resulting string from line 34 is /usr/local//etc/haproxy which is not a vaild path.

I don't understand why the /usr/local prefix is added to the configuration directory. The configuration directory could just be in the path specified by node['haproxy']['conf_dir'].

nitinmohan87 commented 10 years ago

Ok. I was wrong in saying /usr/local//etc/haproxy is not a valid path. Learned something new.

But the actual problem is the haproxy.cfg file is not generated inside /usr/local/etc/haproxy. Its always generated in /etc/haproxy due to this - https://github.com/hw-cookbooks/haproxy/blob/master/providers/default.rb#L4

So if we are installing from source, the LWRP must update the config directory path to point to /usr/local/etc/haproxy instead of the default /etc/haproxy.

ge1st commented 10 years ago

:+1: I'm also running into this bug. But I think there should be a discrete PR to fix this instead of a 'various' fixes request like #68. It may get merged quicker.

pkoraca commented 10 years ago

If you use wrapper cookbook you can override default attribute from install_source recipe:

node.override['haproxy']['conf_dir'] = '/etc/haproxy'

Not sure if that is the best way but it works

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.