working textradius export
[freeside.git] / FS / FS / part_export / textradius.pm
index 691753f..1492f26 100644 (file)
@@ -43,7 +43,7 @@ sub textradius_queue {
     'job'    => "FS::part_export::textradius::textradius_$method",
   };
   $queue->insert(
     'job'    => "FS::part_export::textradius::textradius_$method",
   };
   $queue->insert(
-    $self->option('user'),
+    $self->option('user')||'root',
     $self->machine,
     $self->option('users'),
     @_,
     $self->machine,
     $self->option('users'),
     @_,
@@ -55,7 +55,7 @@ sub textradius_insert { #subroutine, not method
 
   #silly arg processing
   my($att, @check);
 
   #silly arg processing
   my($att, @check);
-  push @check, $att while ($att=shift @attributes) ne '-';
+  push @check, $att while @attributes && ($att=shift @attributes) ne '-';
   my %check = @check;
   my %reply = @attributes;
 
   my %check = @check;
   my %reply = @attributes;
 
@@ -126,7 +126,13 @@ sub textradius_download {
   $rsync->exec( {
     src  => "$user\@$host:$users",
     dest => $dest,
   $rsync->exec( {
     src  => "$user\@$host:$users",
     dest => $dest,
-  } );
+  } ); # true/false return value from exec is not working, alas
+  if ( $rsync->err ) {
+    die "error downloading $user\@$host:$users : ".
+        'exit status: '. $rsync->status. ', '.
+        'STDERR: '. join(" / ", $rsync->err). ', '.
+        'STDOUT: '. join(" / ", $rsync->out);
+  }
 
   $dest;
 }
 
   $dest;
 }
@@ -145,7 +151,13 @@ sub textradius_upload {
   $rsync->exec( {
     src  => "$dir/users",
     dest => "$user\@$host:$users",
   $rsync->exec( {
     src  => "$dir/users",
     dest => "$user\@$host:$users",
-  } );
+  } ); # true/false return value from exec is not working, alas
+  if ( $rsync->err ) {
+    die "error uploading to $user\@$host:$users : ".
+        'exit status: '. $rsync->status. ', '.
+        'STDERR: '. join(" / ", $rsync->err). ', '.
+        'STDOUT: '. join(" / ", $rsync->out);
+  }
 
   flock(LOCK,LOCK_UN);
   close LOCK;
 
   flock(LOCK,LOCK_UN);
   close LOCK;