krimdomu/Rex — pull request #19 by hnakamur (2012-03-07 15:13:43+00:00)
Title: Fix expect call in rsync

Hi,
Here is a fix for expect methods calls in Rex::Commands::Rsync.

We must need arrays for each pair of a regular expression and a procedure, like below:
$exp->expect($timeout,
[ qr/username: /i, sub { my $self = shift;
$self->send("$username\n");
exp_continue; }],
[ qr/password: /i, sub { my $self = shift;
$self->send("$password\n");
exp_continue; }],
$shell_prompt);
Quoted from http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod#USAGE

I tried to use Rex::Commands::Rsync with password authentication,
but rex stopped at the login prompt. I retried with rex -d, but it never prints
"Want Password". My environment was CentOS 5.4 (Yes, I know it's very old,
but I am not allowed to upgrade there.), and used built-in perl rpm.

With this fix, it now works correctly. Please review this fix and include it if it is OK.
Then, perhaps we should fix other expect method calls as well.