mirror of
				https://github.com/liberatedsystems/Sideband_CE.git
				synced 2024-09-03 04:13:27 +02:00 
			
		
		
		
	Added error handling to config reload
This commit is contained in:
		
							parent
							
								
									10273d3e85
								
							
						
					
					
						commit
						bf74698058
					
				@ -612,11 +612,16 @@ class SidebandCore():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def __reload_config(self):
 | 
					    def __reload_config(self):
 | 
				
			||||||
        RNS.log("Reloading Sideband configuration... "+str(self.config_path), RNS.LOG_DEBUG)
 | 
					        RNS.log("Reloading Sideband configuration... "+str(self.config_path), RNS.LOG_DEBUG)
 | 
				
			||||||
        config_file = open(self.config_path, "rb")
 | 
					        with open(self.config_path, "rb") as config_file:
 | 
				
			||||||
        self.config = msgpack.unpackb(config_file.read())
 | 
					            config_data = config_file.read()
 | 
				
			||||||
        config_file.close()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.update_active_lxmf_propagation_node()
 | 
					        try:
 | 
				
			||||||
 | 
					            unpacked_config = msgpack.unpackb(config_data)
 | 
				
			||||||
 | 
					            if unpacked_config != None and len(unpacked_config) != 0:
 | 
				
			||||||
 | 
					                self.config = unpacked_config
 | 
				
			||||||
 | 
					                self.update_active_lxmf_propagation_node()
 | 
				
			||||||
 | 
					        except Exception as e:
 | 
				
			||||||
 | 
					            RNS.log("Error while reloading configuration: "+str(e), RNS.LOG_ERROR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __save_config(self):
 | 
					    def __save_config(self):
 | 
				
			||||||
        RNS.log("Saving Sideband configuration...", RNS.LOG_DEBUG)
 | 
					        RNS.log("Saving Sideband configuration...", RNS.LOG_DEBUG)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user