[freeside-commits] branch FREESIDE_4_BRANCH updated. 747dacf1b1d4e623b63ca6e2eda5be454612441a

Christopher Burger burgerc at freeside.biz
Wed Feb 13 10:24:09 PST 2019


The branch, FREESIDE_4_BRANCH has been updated
       via  747dacf1b1d4e623b63ca6e2eda5be454612441a (commit)
       via  ee15af0a08d10cdc6fcf7631d62fb246953b1b38 (commit)
      from  14be094b5656a1c460afc1670b6765549630676a (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 747dacf1b1d4e623b63ca6e2eda5be454612441a
Merge: ee15af0a0 14be094b5
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Wed Feb 13 13:23:30 2019 -0500

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


commit ee15af0a08d10cdc6fcf7631d62fb246953b1b38
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 db42f6107..190f1ef33 100644
--- a/FS/FS/part_export/saisei.pm
+++ b/FS/FS/part_export/saisei.pm
@@ -371,7 +371,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;
 }
@@ -410,37 +410,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