forked from sous-chefs/haproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into expose-admin-list…
…ener-options Conflicts: README.md
- Loading branch information
Showing
11 changed files
with
193 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'spec_helper' | ||
|
||
haproxyConfigFile = '/etc/haproxy/haproxy.cfg' | ||
|
||
describe 'haproxy::install_package' do | ||
let(:chef_run) { ChefSpec::Runner.new().converge(described_recipe) } | ||
|
||
it 'Installs the haproxy package' do | ||
expect(chef_run).to install_package 'haproxy' | ||
end | ||
|
||
givenVersion = '1.2.3.4' | ||
|
||
# re-converge | ||
let(:chef_run) do | ||
ChefSpec::Runner.new do |node| | ||
node.set['haproxy']['package']['version'] = givenVersion | ||
end.converge(described_recipe) | ||
end | ||
|
||
it 'Installs the haproxy package at a given version' do | ||
expect(chef_run).to install_package('haproxy').with_version(givenVersion) | ||
end | ||
|
||
end | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Added by ChefSpec | ||
require 'chefspec' | ||
|
||
# Uncomment to use ChefSpec's Berkshelf extension | ||
require 'chefspec/berkshelf' | ||
|
||
RSpec.configure do |config| | ||
# Specify the path for Chef Solo to find cookbooks | ||
# config.cookbook_path = '/var/cookbooks' | ||
|
||
# Specify the path for Chef Solo to find roles | ||
# config.role_path = '/var/roles' | ||
|
||
# Specify the Chef log_level (default: :warn) | ||
# config.log_level = :debug | ||
|
||
# Specify the path to a local JSON file with Ohai data | ||
# config.path = 'ohai.json' | ||
|
||
# Specify the operating platform to mock Ohai data from | ||
# config.platform = 'ubuntu' | ||
|
||
# Specify the operating version to mock Ohai data from | ||
# config.version = '12.04' | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/bin/sh | ||
# | ||
# haproxy | ||
# | ||
# chkconfig: - 85 15 | ||
# description: HAProxy is a free, very fast and reliable solution \ | ||
# offering high availability, load balancing, and \ | ||
# proxying for TCP and HTTP-based applications | ||
# processname: haproxy | ||
# config: <%= @conf_dir %>/haproxy.cfg | ||
# pidfile: /var/run/haproxy.pid | ||
|
||
# Written by Chef on <%= @hostname %> | ||
|
||
# Source function library. | ||
. /etc/rc.d/init.d/functions | ||
|
||
# Source networking configuration. | ||
. /etc/sysconfig/network | ||
|
||
# Check that networking is up. | ||
[ "$NETWORKING" = "no" ] && exit 0 | ||
|
||
config="<%= @conf_dir %>/haproxy.cfg" | ||
exec="<%= @prefix %>/sbin/haproxy" | ||
prog=$(basename $exec) | ||
|
||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog | ||
|
||
lockfile=/var/lock/subsys/haproxy | ||
|
||
check() { | ||
$exec -c -V -f $config | ||
} | ||
|
||
start() { | ||
$exec -c -q -f $config | ||
if [ $? -ne 0 ]; then | ||
echo "Errors in configuration file, check with $prog check." | ||
return 1 | ||
fi | ||
|
||
echo -n $"Starting $prog: " | ||
# start it up here, usually something like "daemon $exec" | ||
daemon $exec -D -f $config -p /var/run/$prog.pid | ||
retval=$? | ||
echo | ||
[ $retval -eq 0 ] && touch $lockfile | ||
return $retval | ||
} | ||
|
||
stop() { | ||
echo -n $"Stopping $prog: " | ||
# stop it here, often "killproc $prog" | ||
killproc $prog | ||
retval=$? | ||
echo | ||
[ $retval -eq 0 ] && rm -f $lockfile | ||
return $retval | ||
} | ||
|
||
restart() { | ||
$exec -c -q -f $config | ||
if [ $? -ne 0 ]; then | ||
echo "Errors in configuration file, check with $prog check." | ||
return 1 | ||
fi | ||
stop | ||
start | ||
} | ||
|
||
reload() { | ||
$exec -c -q -f $config | ||
if [ $? -ne 0 ]; then | ||
echo "Errors in configuration file, check with $prog check." | ||
return 1 | ||
fi | ||
echo -n $"Reloading $prog: " | ||
$exec -D -f $config -p /var/run/$prog.pid -sf $(cat /var/run/$prog.pid) | ||
retval=$? | ||
echo | ||
return $retval | ||
} | ||
|
||
force_reload() { | ||
restart | ||
} | ||
|
||
fdr_status() { | ||
status $prog | ||
} | ||
|
||
case "$1" in | ||
start|stop|restart|reload) | ||
$1 | ||
;; | ||
force-reload) | ||
force_reload | ||
;; | ||
check) | ||
check | ||
;; | ||
status) | ||
fdr_status | ||
;; | ||
condrestart|try-restart) | ||
[ ! -f $lockfile ] || restart | ||
;; | ||
*) | ||
echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}" | ||
exit 2 | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ setup() { | |
|
||
|
||
teardown(){ | ||
pkill -9 nc | ||
pkill -9 nc || true | ||
} | ||
|
||
|
||
|