diff --git a/lib/database.py b/lib/database.py index 6ad3a39..67d63b6 100755 --- a/lib/database.py +++ b/lib/database.py @@ -2168,7 +2168,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 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')