mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 11:22:27 +00:00 
			
		
		
		
	workaround python agent when /dev/log is not available (#5051)
This commit is contained in:
		| @@ -23,7 +23,11 @@ def getxCATLog(name=None): | ||||
|     return xl | ||||
|  | ||||
| def enableSyslog(name='xcat'): | ||||
|     h = SysLogHandler(address='/dev/log', facility=SysLogHandler.LOG_LOCAL4) | ||||
|     try: | ||||
|         h = SysLogHandler(address='/dev/log', facility=SysLogHandler.LOG_LOCAL4) | ||||
|     except: | ||||
|         # this will connect localhost:514 | ||||
|         h = SysLogHandler(facility=SysLogHandler.LOG_LOCAL4) | ||||
|     h.setFormatter(logging.Formatter('%s: ' % name + '%(levelname)s %(message)s')) | ||||
|     logging.getLogger('xcatagent').addHandler(h) | ||||
|  | ||||
|   | ||||
| @@ -33,8 +33,11 @@ from hwctl.eventlog import DefaultEventlogManager | ||||
| from xcatagent import base | ||||
| import logging | ||||
| logger = logging.getLogger('xcatagent') | ||||
| if not logger.handlers: | ||||
|     utils.enableSyslog('xcat.agent') | ||||
| try: | ||||
|     if not logger.handlers: | ||||
|         utils.enableSyslog('xcat.agent') | ||||
| except: | ||||
|     pass | ||||
|  | ||||
| HTTP_PROTOCOL = "https://" | ||||
| PROJECT_URL = "/xyz/openbmc_project" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user