hibari / clus

Cluster is a simple tool for installing, configuring, and bootstrapping a cluster of nodes - primarily Hibari nodes.
Other
5 stars 4 forks source link

clus.sh init fails at running ssh-copy-id command under slow ssh session #4

Open tatsuya6502 opened 9 years ago

tatsuya6502 commented 9 years ago

The init command in clus.sh uses expect command when it runs ssh-copy-id command.

    { eval "$EXPECT -c 'spawn $SSHCOPYID $NODE_USER@$NODE_HOST' -c 'expect password:' -c 'send $passwd\n' -c 'expect eof' &> $NULLFILE"; } || \
        die "remote user '$NODE_USER@$NODE_HOST' ssh-copy-id failed"

There seems two problems with this implementation:

  1. The default timeout for expect seems too short, so if ssh session is slow (e.g. sshd can't resolve ssh client's host name -- UseDNS yes), expect will fire send $passwd\n before establishing the session. This causes ssh-copy-id command to fail.
  2. When the timeout occurs, die ... part won't detect the error.