[freeside-commits] freeside/FS/FS/part_export shellcommands.pm, 1.57.4.3, 1.57.4.4 shellcommands_withdomain.pm, 1.13, 1.13.6.1

Mark Wells mark at wavetail.420.am
Tue Dec 13 13:15:59 PST 2011


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

Modified Files:
      Tag: FREESIDE_2_3_BRANCH
	shellcommands.pm shellcommands_withdomain.pm 
Log Message:
option for shellcommands to ignore errors, #15357

Index: shellcommands.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/shellcommands.pm,v
retrieving revision 1.57.4.3
retrieving revision 1.57.4.4
diff -u -w -d -r1.57.4.3 -r1.57.4.4
--- shellcommands.pm	6 Oct 2011 05:51:18 -0000	1.57.4.3
+++ shellcommands.pm	13 Dec 2011 21:15:57 -0000	1.57.4.4
@@ -80,7 +80,11 @@
                              'Radius group mapping to reason (via template user)',
 			    type  => 'textarea',
 			  },
-  'ignored_errors' => { label   => 'Regexes of errors to ignore, separated by newlines',
+  'ignore_all_output' => { 
+      label => 'Ignore all output and errors from the command',
+      type  => 'checkbox',
+  },
+  'ignored_errors' => { label   => 'Regexes of specific errors to ignore, separated by newlines',
                         type    => 'textarea'
                       },
 #  'no_queue' => { label => 'Run command immediately',
@@ -354,6 +358,7 @@
     host          => $self->machine,
     command       => $command_string,
     stdin_string  => $stdin_string,
+    ignore_all_output => $self->option('ignore_all_output'),
     ignored_errors => $self->option('ignored_errors') || '',
   );
 
@@ -447,6 +452,7 @@
     host          => $self->machine,
     command       => $command_string,
     stdin_string  => $stdin_string,
+    ignore_all_output => $self->option('ignore_all_output'),
     ignored_errors => $self->option('ignored_errors') || '',
   );
 
@@ -480,12 +486,14 @@
     $opt->{'user'}.'@'.$opt->{'host'},
     'default_stdin_fh' => $def_in
   );
+  # ignore_all_output doesn't override this
   die "Couldn't establish SSH connection: ". $ssh->error if $ssh->error;
 
   my $ssh_opt = {};
   $ssh_opt->{'stdin_data'} = $opt->{'stdin_string'}
     if exists($opt->{'stdin_string'}) and length($opt->{'stdin_string'});
   my ($output, $errput) = $ssh->capture2($ssh_opt, $opt->{'command'});
+  return if $opt->{'ignore_all_output'};
   die "Error running SSH command: ". $ssh->error if $ssh->error;
 
   if ($errput && $opt->{'ignored_errors'} && length($opt->{'ignored_errors'})) {

Index: shellcommands_withdomain.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/shellcommands_withdomain.pm,v
retrieving revision 1.13
retrieving revision 1.13.6.1
diff -u -w -d -r1.13 -r1.13.6.1
--- shellcommands_withdomain.pm	5 Mar 2010 18:24:56 -0000	1.13
+++ shellcommands_withdomain.pm	13 Dec 2011 21:15:57 -0000	1.13.6.1
@@ -66,6 +66,10 @@
                type=>'select', options=>[qw(crypt md5)],
                default => 'crypt',
              },
+  'ignore_all_output' => {
+    label => 'Ignore all output and errors from the command',
+    type  => 'checkbox',
+  },
 ;
 
 %info = (



More information about the freeside-commits mailing list