Add a cp_origin parameter in the Vagrantfile

* "test": use the local repository
* "origin": use the latest official release
This commit is contained in:
benoit 2022-07-15 10:32:07 +02:00 committed by Benoit
parent e3d1ac9581
commit d5adcd9db3
2 changed files with 20 additions and 3 deletions

5
vagrant/Vagrantfile vendored
View file

@ -12,6 +12,10 @@ etcd_nodes = []
patroni_nodes = []
sup_nodes = ['s1']
# install check_patroni from the local repo (test) or from pip (official)
cp_origin = 'test' # [test, official]
Vagrant.configure(2) do |config|
config.vm.provider myProvider
@ -56,6 +60,7 @@ Vagrant.configure(2) do |config|
args: [ node ],
preserve_order: true
conf.vm.provision 'check_patroni', type: 'shell', path: 'provision/check_patroni.bash',
args: [ cp_origin ],
preserve_order: true
end
end

View file

@ -4,6 +4,8 @@ info (){
echo "$1"
}
ORIGIN=$1
set -o errexit
set -o nounset
set -o pipefail
@ -15,8 +17,18 @@ info "#=========================================================================
DEBIAN_FRONTEND=noninteractive apt install -q -y git python3-pip
pip3 install --upgrade pip
cd /check_patroni
pip3 install .
ln -s /usr/local/bin/check_patroni /usr/lib/nagios/plugins/check_patroni
case "$ORIGIN" in
"test")
cd /check_patroni
pip3 install .
ln -s /usr/local/bin/check_patroni /usr/lib/nagios/plugins/check_patroni
;;
"official")
pip3 install check_patroni
;;
*)
echo "Origin : [$ORIGIN] is not supported"
exit 1
esac
check_patroni --version