Subject: | Wrapper bug when called from Dancer |
Date: | Mon, 8 Jul 2013 10:30:39 +0000 |
To: | bug-Net-CLI-Interact [...] rt.cpan.org |
From: | Freyr Guðjónsson <ze [...] anime.is> |
Running:
Net::CLI::Interact 2.131260
Net::Appliance::Session 4.131260
Dancer 1.3116
Perl v5.14.2
Kali Linux (debian)
Linux freyrg-kali 3.7-trunk-amd64 #1 SMP Debian 3.7.2-0+kali8 x86_64
GNU/Linux
When running Net::Appliance::Session from within a Dancer webapp has some
unexpected behavior. When using Telnet to connect to Cisco equipment the
process runs fine, however when using SSH it seems like Net::CLI::Interact
loses it's handle for the output of SSH. This causes the output to come in
the console for the Dancer app and won't be caught by the wrapper. This
causes the connection to time out.
Output from Dancer is something like this:
[29146] core @0.001174> [hit #1]Trying to match 'POST /setup/metro'
against /^\/setup\/metro$/ (generated from '/setup/metro') in
/usr/local/share/perl/5.14.2/Dancer/Route.pm l. 84
[29146] core @0.001272> [hit #1] --> got 1 in
/usr/local/share/perl/5.14.2/Dancer/Route.pm l. 102
user: freyrg, pass: Qwert2asd, einhver config
[ 0.005539] pr finding prompt
[ 0.007692] tr creating Net::Telnet wrapper for ssh
[ 0.008438] tr connecting with: ssh -o StrictHostKeyChecking=no -o
UserKnownHostsFile=/dev/null -o CheckHostIP=no -T -l freyrg a001
[ 0.504995] pr output matching prompt was "Password: "
[ 0.508555] pr finding prompt
Unauthorized Access not allowed, connections are logged and monitored.
A001-S#[ 11.517640] pr failed: [read timed-out at
/usr/local/share/perl/5.14.2/Net/CLI/Interact/Transport/Wrapper/Net_Telnet.pm
line 35
], sending WAKE_UP and trying again
[ 11.517940] pr finding prompt
[29146] error @22.602266> [hit #1]request to POST /setup/metro crashed:
login failed to remote host - prompt does not match at
/usr/local/share/perl/5.14.2/Net/Appliance/Session/Transport.pm line 78. in
/usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 98
[29146] core @22.603594> [hit #1]response: 500 in
/usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 179
As can be seen, after logging in with the password, it starts looking for
the prompt, but that's when the router output starts coming into the
console, and then finally the log from Net::CLI::Interact states that it
has timed out, then the POST route crashes in Dancer.
I