4.3.0: Merge pull request #6 from 2600hz/efine/portability-issues
kazoo-configs-haproxy Changes
Difference between master and 4.2
Unticketed Commits
- Merge pull request #6 from 2600hz/efine/portability-issues Fix some portability issues by lazedo
- Add KillMode=mixed to systemd service for more reliable haproxy shutdown by Edwin Fine
- [Fix some portability issues Summary ======= There are three portability issues addressed in this commit: 1. Specifying the shebang as
#!/bin/sh
and then using Bashisms 2. Mixing Bashisms and sh 2. A clash between the meaning ofnc
on Debian and CentOS Bashisms -------- Runningsystemctl start kazoo-haproxy
on Debian 8 resulted in this error: /usr/sbin/kazoo-haproxy: 51: : root: unexpected operator The reason for the error is that the script's shebang is#!/bin/sh
, which has different behavior on Debian 8 compared to CentOS 7. In CentOS 7,/bin/sh
is symlinked to/bin/bash
, but on Debian 8, it's symlinked to/bin/dash
, which behaves more like the original Bourne shell,sh
. See [HTMBSWID][How to make Bash scripts work in dash] for detail.sh
(anddash
) supports=
, but not==
, as a string comparison operator, hence one error. Furthermore,bash
does not allow==
This part of the commit does the following: 1. Change all occurrences of==
to=
2. Change the shebang to#!/bin/bash
nc
vsncat
-------------- - On CentOS,nc
is another way of runningncat
. - On Debian,nc
isnetcat
, a totally different utility. Debianncat
seems to hang when used inkazoo-haproxy
. After some debugging and research, replacing the use of ncat -U ${SOCKET} with socat stdio unix-connect:${SOCKET} seems to work perfectly in both Debian and CentOS, so this commit adopts the use ofsocat
. [HTMBSWID]: http://mywiki.wooledge.org/Bashism by Edwin Fine