Merge branch 'develop' into dist/eole/2.7.0/develop
This commit is contained in:
commit
45c7004aed
|
@ -16,15 +16,19 @@ function copy_ssh_id()
|
||||||
local host=${1}
|
local host=${1}
|
||||||
|
|
||||||
CLEF=$(cat ~oneadmin/.ssh/id_rsa.pub)
|
CLEF=$(cat ~oneadmin/.ssh/id_rsa.pub)
|
||||||
ssh ${host} bash -s <<EOF
|
ssh ${host} bash -x <<EOF
|
||||||
if ! grep -qs $CLEF ~oneadmin/.ssh/authorized_keys
|
if ! grep -qs "$CLEF" ~oneadmin/.ssh/authorized_keys; then
|
||||||
then
|
echo "$CLEF" >> ~oneadmin/.ssh/authorized_keys
|
||||||
echo $CLEF >> ~oneadmin/.ssh/authorized_keys
|
|
||||||
chown oneadmin:oneadmin ~oneadmin/.ssh/authorized_keys
|
chown oneadmin:oneadmin ~oneadmin/.ssh/authorized_keys
|
||||||
|
su - oneadmin -c "ssh-keyscan $host"
|
||||||
|
cat ~oneadmin/.ssh/id_rsa.pub >> ~oneadmin/.ssh/authorized_keys
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
su - oneadmin -c "ssh-keyscan $host"
|
[[ ${?} -ne 0 ]] && EchoRouge "Erreur lors de l'échange de clés SSH avec le noeud ${host}"
|
||||||
return ${?}
|
REMOTEKEY=$(su - oneadmin -c "ssh ${host} 'cat ~oneadmin/.ssh/id_rsa.pub'")
|
||||||
|
if ! grep -qs "$REMOTEKEY" ~oneadmin/.ssh/authorized_keys; then
|
||||||
|
su - oneadmin -c "echo ${REMOTEKEY} >> ~oneadmin/.ssh/authorized_keys"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -65,10 +69,10 @@ function sync_host()
|
||||||
#
|
#
|
||||||
function wait_node_ok()
|
function wait_node_ok()
|
||||||
{
|
{
|
||||||
local RET=0
|
|
||||||
local cmd="onehost show ${1} | awk '/^STATE/ {print \$3}'"
|
local cmd="onehost show ${1} | awk '/^STATE/ {print \$3}'"
|
||||||
local spinstr='|/-\'
|
local spinstr='|/-\'
|
||||||
local delay=0.75
|
local delay=0.75
|
||||||
|
local cnt=0
|
||||||
|
|
||||||
while [ 1 ]
|
while [ 1 ]
|
||||||
do
|
do
|
||||||
|
@ -77,19 +81,20 @@ function wait_node_ok()
|
||||||
[[ ${st} == '' ]] && break
|
[[ ${st} == '' ]] && break
|
||||||
if [[ ${st} == "ERROR" ]]
|
if [[ ${st} == "ERROR" ]]
|
||||||
then
|
then
|
||||||
RET=50
|
if [ $cnt -gt 160 ]; then
|
||||||
|
EchoRouge "Erreur lors de l'enregistrement du noeud ${host} !"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
local temp=${spinstr#?}
|
local temp=${spinstr#?}
|
||||||
printf " [%c] " "$spinstr"
|
printf " [%c] " "$spinstr"
|
||||||
local spinstr=$temp${spinstr%"$temp"}
|
local spinstr=$temp${spinstr%"$temp"}
|
||||||
sleep $delay
|
sleep $delay
|
||||||
printf "\b\b\b\b\b\b"
|
printf "\b\b\b\b\b\b"
|
||||||
|
cnt=$((cnt+1))
|
||||||
done
|
done
|
||||||
printf " \b\b\b\b"
|
printf " \b\b\b\b"
|
||||||
return ${RET}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_ha_leader() {
|
function init_ha_leader() {
|
||||||
|
@ -135,7 +140,7 @@ fi
|
||||||
|
|
||||||
follower=1
|
follower=1
|
||||||
master=1
|
master=1
|
||||||
if [ "$(CreoleGet activer_one_ha)" = "oui" ];
|
if [ "$(CreoleGet activer_one_ha)" = "oui" ]; then
|
||||||
if [ "$(CreoleGet one_ha_server_index)" != "0" ]; then
|
if [ "$(CreoleGet one_ha_server_index)" != "0" ]; then
|
||||||
follower=0
|
follower=0
|
||||||
else
|
else
|
||||||
|
@ -149,7 +154,6 @@ for host in ${HAPY_SLV}; do
|
||||||
EchoVert " * Gestion des clés SSH"
|
EchoVert " * Gestion des clés SSH"
|
||||||
echo
|
echo
|
||||||
copy_ssh_id ${host}
|
copy_ssh_id ${host}
|
||||||
[[ ${?} -ne 0 ]] && EchoRouge "Erreur lors de l'échange de clés SSH avec le noeud ${host}"
|
|
||||||
if [ $follower = 0 ]; then
|
if [ $follower = 0 ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -158,10 +162,6 @@ for host in ${HAPY_SLV}; do
|
||||||
register_node ${host}
|
register_node ${host}
|
||||||
sync_host ${host}
|
sync_host ${host}
|
||||||
wait_node_ok ${host}
|
wait_node_ok ${host}
|
||||||
if [[ ${?} -ne 0 ]]
|
|
||||||
then
|
|
||||||
EchoRouge "Erreur lors de l'enregistrement du noeud ${host} !"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $master = 0 ]; then
|
if [ $master = 0 ]; then
|
||||||
|
|
Loading…
Reference in New Issue