同じコマンドが最初の繰り返しで失敗しますが、2 回目の繰り返しで合格します。両方の反復で通過する場合があります。$ssh
のオブジェクトですNet::SSH::Expect
。この奇妙な振る舞いについて何か考えはありますか?
$ssh = Net::SSH::Expect->new(
host => "$host",
password => "$pass",
user => "$id",
raw_pty => 1,
timeout => 50
);
コードスニペット:
&Test("Create exports on Sonas------ No Kerberos");
$no_of_exports=2;
my $fs = "/ibm/gpfs0/";
while($no_of_exports)
{
my $share_name = &get_share_name();
my $path="$fs" . "$share_name";
$cmd="ssh mgmt001st001 mkexport $share_name $path --nfs 'client002\\\\(rw,no_root_squash\\)'";
print "CMD: $cmd";
$out=$ssh->exec("$cmd");
print $out;
--$no_of_exports;
}
出力:
Test 02 : Create exports on *Sonas*------ No Kerberos
CMD: ssh mgmt001st001 mkexport kas41535108 /ibm/gpfs0/kas41535108 --nfs 'client002\\ (rw,no_root_squash\)'
--nfs 'client002\\(xport kas41535108 /ibm/gpfs0/kas41535108
> rw,no_root_squash\)'
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `mkexport kas41535108 /ibm/gpfs0/kas41535108 --nfs client002\\('
[root@ganesha36 ~]#
[root@ganesha36 ~]#
CMD: ssh mgmt001st001 mkexport kas219760489 /ibm/gpfs0/kas219760489 --nfs 'client002\\ (rw,no_root_squash\)'
89 --nfs 'client002\xport kas219760489 /ibm/gpfs0/kas2197604
> \(rw,no_root_squash\)'
EFSSG0019I The export kas219760489 has been successfully created.
EFSSG1000I The command completed successfully.