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