From 843fd723ff3fec43dd80c981b9ee313720c52ba0 Mon Sep 17 00:00:00 2001 From: Runamook Date: Sun, 22 Sep 2024 21:07:22 +0300 Subject: [PATCH 1/2] Fix attach without charging rules in the DB --- lib/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/database.py b/lib/database.py index 36559aa..211ee50 100755 --- a/lib/database.py +++ b/lib/database.py @@ -2152,7 +2152,7 @@ def Get_Charging_Rules(self, imsi, apn): ChargingRule['apn_data'] = apn_data #Get Charging Rules list - if apn_data['charging_rule_list'] == None: + if not apn_data['charging_rule_list'] or apn_data['charging_rule_list'].strip() == '': self.logTool.log(service='Database', level='debug', message="No Charging Rule associated with this APN", redisClient=self.redisMessaging) ChargingRule['charging_rules'] = None return ChargingRule From b2a08f345416a16e0a3378409a643c50c968dde5 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Tue, 8 Oct 2024 22:57:59 +0200 Subject: [PATCH 2/2] tools/view_stats.py: exit properly when no info is on Redis fixes #208 --- tools/view_stats.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/view_stats.py b/tools/view_stats.py index 8b3c920..defe4ee 100644 --- a/tools/view_stats.py +++ b/tools/view_stats.py @@ -1,4 +1,4 @@ -#This utility prints PyHSS stats stored in Redis +# This utility prints PyHSS stats stored in Redis import yaml import sys with open(sys.path[0] + '/../config.yaml') as stream: @@ -15,12 +15,13 @@ print("\n\nDiameter Peers:") ActivePeerDict = r.get('ActivePeerDict') -if len(ActivePeerDict) == 0: +if ActivePeerDict is None or len(ActivePeerDict) == 0: print("No connected peers.") + sys.exit() ActivePeerDict = json.loads(ActivePeerDict) for keys in ActivePeerDict: print(keys) for subkeys in ActivePeerDict[keys]: print("\t" + str(subkeys) + ": \t" + str(ActivePeerDict[keys][subkeys])) - print('\n') \ No newline at end of file + print('\n')