Commit 8bb71e51 authored by Alain Takoudjou's avatar Alain Takoudjou

repan: add cluster if not exists yet

parent cdcc1000
...@@ -58,7 +58,7 @@ md5sum = c203f40a58386310a433b58fd345a341 ...@@ -58,7 +58,7 @@ md5sum = c203f40a58386310a433b58fd345a341
[repman-manager-sh.in] [repman-manager-sh.in]
_update_hash_filename_ = templates/repman-manager.sh.in _update_hash_filename_ = templates/repman-manager.sh.in
md5sum = 5d22f599b39c25c285d0e9c02e7074a3 md5sum = a4e5bb1f5dfe52f6ba17e3a029f4f130
[dbjobs-in] [dbjobs-in]
_update_hash_filename_ = templates/dbjobs.in _update_hash_filename_ = templates/dbjobs.in
......
...@@ -59,12 +59,24 @@ activate_proxy () { ...@@ -59,12 +59,24 @@ activate_proxy () {
fi fi
} }
check_add () {
NAME=$1
STATUS=$(curl -H "Authorization: Bearer ${TOKEN}" -o /dev/null -w "%{http_code}" {{ secure_url }}/api/clusters/$NAME)
if [ $STATUS != 200 ]; then
# if cluster doesn't exists we add it
curl -H "Authorization: Bearer ${TOKEN}" \
{{ secure_url }}/api/clusters/actions/add/$NAME
fi
}
TOKEN=$(get_token | {{ jq_bin }} -r '.token') TOKEN=$(get_token | {{ jq_bin }} -r '.token')
# Always reload cluster configuration to apply recent changes # Always reload cluster configuration to apply recent changes
{% for name in cluster_name_list -%} {% for name in cluster_name_list -%}
check_add {{ name }}
# reload {{ name }} settings # reload {{ name }} settings
echo "Reloading settings for {{ name }}..." echo "Reloading settings for {{ name }}..."
curl -H "Authorization: Bearer ${TOKEN}" \ curl -H "Authorization: Bearer ${TOKEN}" \
{{ secure_url }}/api/clusters/{{ name }}/settings/actions/reload {{ secure_url }}/api/clusters/{{ name }}/settings/actions/reload
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment