Closed sophomeric closed 8 years ago
I think you get an error because HAProxy class calls connected_socket in https://github.com/unixsurfer/haproxyadmin/blob/master/haproxyadmin/haproxy.py#L112 and that function raises exceptions https://github.com/unixsurfer/haproxyadmin/blob/872e22ba1496e6026742948db40aa33fb58cb391/haproxyadmin/utils.py#L162 which are not catched. Can I have the exact error you get?
I believe the real issue is in haproxyadmin lib which doesn't catch the exceptions. I am believe the right approach here would be to make HAProxy class to scan the dir set in socket_dir and exclude files that aren't valid HAProxy stats socket files.
This doesn't mean we should not add the -F argument in haproxytool.
What do you think?
Sure, that sounds better.
$ ./test/bin/haproxytool server -D /tmp -s No permissions are granted to access socket file /tmp/mongodb-27017.sock $ ll /tmp/mongodb-27017.sock srwx------ 1 mongodb nogroup 0 Jan 27 14:07 /tmp/mongodb-27017.sock=
And in this case this is expected and fine. The haproxy socket is also in /tmp for me and without being able to either ignore that socket(s) it can't access or specify a socket to use, I can't use the tool.
OK, I propose to reject this PR and 1) fix HAProxy class to ignore invalid HProxy stats files when it scans a directory 2) Add -F in haproxytool without a default value and it will be mutually exclusive with -D, so a user can only one of them.
Do you agree ?
Sounds perfect.
Setting a single socket file is available in 0.5.0 version. You should consider using haproxyadmin 0.2.1 version as it addresses the initial issue you reported.
I updated both and they work as advertised. Thanks!