mirror of https://github.com/jumpserver/jumpserver
				
				
				
			[Update] 更改命令执行超时提示
							parent
							
								
									d5cb0a2e59
								
							
						
					
					
						commit
						9bb7c1adc1
					
				| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
import uuid
 | 
			
		||||
import json
 | 
			
		||||
 | 
			
		||||
from celery.exceptions import SoftTimeLimitExceeded
 | 
			
		||||
from django.utils import timezone
 | 
			
		||||
from django.utils.translation import ugettext_lazy as _
 | 
			
		||||
from django.utils.translation import ugettext
 | 
			
		||||
| 
						 | 
				
			
			@ -64,6 +65,9 @@ class CommandExecution(models.Model):
 | 
			
		|||
            try:
 | 
			
		||||
                result = runner.execute(self.command, 'all')
 | 
			
		||||
                self.result = result.results_command
 | 
			
		||||
            except SoftTimeLimitExceeded as e:
 | 
			
		||||
                print("Run timeout than 60s")
 | 
			
		||||
                self.result = {"error": str(e)}
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
                print("Error occur: {}".format(e))
 | 
			
		||||
                self.result = {"error": str(e)}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue