[freeside-commits] branch FREESIDE_3_BRANCH updated. a23d1195f67daa63534bb877512c84fbb9893f62

Christopher Burger burgerc at freeside.biz
Wed Feb 13 10:31:55 PST 2019


The branch, FREESIDE_3_BRANCH has been updated
       via  a23d1195f67daa63534bb877512c84fbb9893f62 (commit)
       via  c868e95a3e79af8e1a88bd7ebfb7db5805e1f48d (commit)
      from  a74ee3169c14095667d76dcee227c3ec783d5e96 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a23d1195f67daa63534bb877512c84fbb9893f62
Merge: c868e95a3 a74ee3169
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Wed Feb 13 13:30:38 2019 -0500

    Merge branch 'FREESIDE_3_BRANCH' of ssh://git.freeside.biz/home/git/freeside into FREESIDE_3_BRANCH


commit c868e95a3e79af8e1a88bd7ebfb7db5805e1f48d
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Wed Feb 13 11:57:15 2019 -0500

    RT# 82087 - added logging for decode json error

diff --git a/FS/FS/part_export/saisei.pm b/FS/FS/part_export/saisei.pm
index ce80f5e9f..79358e25a 100644
--- a/FS/FS/part_export/saisei.pm
+++ b/FS/FS/part_export/saisei.pm
@@ -359,7 +359,7 @@ sub get_rateplan_name {
   my $service_name = $svc_name ? $svc_name : $service_part->{Hash}->{svc};
 
   my $rateplan_name = $service_name . " " . $svc_broadband->{Hash}->{speed_down} . "-" . $svc_broadband->{Hash}->{speed_up};
-  $rateplan_name =~ s/\s/_/g;
+  $rateplan_name =~ s/\s/_/g; $rateplan_name =~ s/[^A-Za-z0-9\-_]//g;
 
   return $rateplan_name;
 }
@@ -398,37 +398,39 @@ sub api_call {
   $client->setHost('http://'.$self->{Hash}->{machine}.':'.$self->option('port'));
   $client->$method('/rest/top/configurations/running'.$path, $data, { "Content-type" => 'application/json'});
 
-  warn "Response Code is ".$client->responseCode()."\n" if $self->option('debug');
+  warn "Saisei Response Code is ".$client->responseCode()."\n" if $self->option('debug');
 
   my $result;
 
   if ($client->responseCode() eq '200' || $client->responseCode() eq '201') {
     eval { $result = decode_json($client->responseContent()) };
     unless ($result) {
-      $self->{'__saisei_error'} = "Error decoding json: $@";
+      $self->{'__saisei_error'} = "Error decoding json from Saisei";
+      warn "Saisei RC 201 Response Content is not json\n".$client->responseContent()."\n" if $self->option('debug');
       return;
     }
   }
   elsif ($client->responseCode() eq '404') {
     eval { $result = decode_json($client->responseContent()) };
     unless ($result) {
-      $self->{'__saisei_error'} = "Error decoding json: $@";
+      $self->{'__saisei_error'} = "Error decoding json from Saisei";
+      warn "Saisei RC 404 Response Content is not json\n".$client->responseContent()."\n" if $self->option('debug');
       return;
     }
     ## check if message is for empty hash.
     my($does_not_exist) = $result->{message} =~ /'(.*)' does not exist$/;
     $self->{'__saisei_error'} = "Error ".$result->{message} unless $does_not_exist;
-    warn "Response Content is\n".$client->responseContent."\n" if ($self->option('debug') && !$does_not_exist);
+    warn "Saisei Response Content is\n".$client->responseContent."\n" if ($self->option('debug') && !$does_not_exist);
     return;
   }
   elsif ($client->responseCode() eq '500') {
     $self->{'__saisei_error'} = "Can't connect to host during $method , received responce code: " . $client->responseCode() . " and message: " . $client->responseContent();
-    warn "Response Content is\n".$client->responseContent."\n" if $self->option('debug');
+    warn "Saisei Response Content is\n".$client->responseContent."\n" if $self->option('debug');
     return;
   }
   else {
     $self->{'__saisei_error'} = "Bad response from server during $method , received responce code: " . $client->responseCode() . " and message: " . $client->responseContent();
-    warn "Response Content is\n".$client->responseContent."\n" if $self->option('debug');
+    warn "Saisei Response Content is\n".$client->responseContent."\n" if $self->option('debug');
     return; 
   }
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_export/saisei.pm | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)




More information about the freeside-commits mailing list