[freeside-commits] freeside/FS/FS/part_export www_shellcommands.pm, 1.19, 1.20

Erik Levinson levinse at wavetail.420.am
Thu Jan 20 21:55:47 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv2257/FS/FS/part_export

Modified Files:
	www_shellcommands.pm 
Log Message:
change www_shellcommands to use Net::OpenSSH, RT8115

Index: www_shellcommands.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/www_shellcommands.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -w -d -r1.19 -r1.20
--- www_shellcommands.pm	5 Mar 2010 18:24:56 -0000	1.19
+++ www_shellcommands.pm	21 Jan 2011 05:55:45 -0000	1.20
@@ -177,14 +177,14 @@
 }
 
 sub ssh_cmd { #subroutine, not method
-  use Net::SSH '0.08';
-  &Net::SSH::ssh_cmd( { @_ } );
+  use Net::OpenSSH;
+  my $opt = { @_ };
+  my $ssh = Net::OpenSSH->new($opt->{'user'}.'@'.$opt->{'host'});
+  die "Couldn't establish SSH connection: ". $ssh->error if $ssh->error;
+  my ($output, $errput) = $ssh->capture2($opt->{'command'});
+  die "Error running SSH command: ". $ssh->error if $ssh->error;
+  die $errput if $errput;
+  die $output if $output;
+  '';
 }
 
-#sub shellcommands_insert { #subroutine, not method
-#}
-#sub shellcommands_replace { #subroutine, not method
-#}
-#sub shellcommands_delete { #subroutine, not method
-#}
-



More information about the freeside-commits mailing list