mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Reenable cpstats for rest_cherrypy
This commit is contained in:
parent
cbf752cd73
commit
6bd91c8b03
1 changed files with 13 additions and 11 deletions
|
@ -468,11 +468,19 @@ import tarfile
|
|||
from multiprocessing import Process, Pipe
|
||||
|
||||
# Import third-party libs
|
||||
# pylint: disable=import-error
|
||||
# pylint: disable=import-error, 3rd-party-module-not-gated
|
||||
import cherrypy
|
||||
try:
|
||||
from cherrypy.lib import cpstats
|
||||
except ImportError:
|
||||
cpstats = None
|
||||
logger.warn('Import of cherrypy.cpstats failed. '
|
||||
'Possible upstream bug: '
|
||||
'https://github.com/cherrypy/cherrypy/issues/1444')
|
||||
|
||||
import yaml
|
||||
import salt.ext.six as six
|
||||
# pylint: enable=import-error
|
||||
# pylint: enable=import-error, 3rd-party-module-not-gated
|
||||
|
||||
|
||||
# Import Salt libs
|
||||
|
@ -2446,13 +2454,6 @@ class Stats(object):
|
|||
:status 406: |406|
|
||||
'''
|
||||
if hasattr(logging, 'statistics'):
|
||||
# Late import
|
||||
try:
|
||||
from cherrypy.lib import cpstats
|
||||
except ImportError:
|
||||
logger.error('Import of cherrypy.cpstats failed. Possible '
|
||||
'upstream bug here: https://github.com/cherrypy/cherrypy/issues/1444')
|
||||
return {}
|
||||
return cpstats.extrapolate_statistics(logging.statistics)
|
||||
|
||||
return {}
|
||||
|
@ -2559,13 +2560,14 @@ class API(object):
|
|||
'tools.trailing_slash.on': True,
|
||||
'tools.gzip.on': True,
|
||||
|
||||
'tools.cpstats.on': self.apiopts.get('collect_stats', False),
|
||||
|
||||
'tools.html_override.on': True,
|
||||
'tools.cors_tool.on': True,
|
||||
},
|
||||
}
|
||||
|
||||
if cpstats and self.apiopts.get('collect_stats', False):
|
||||
conf['/']['tools.cpstats.on'] = True
|
||||
|
||||
if 'favicon' in self.apiopts:
|
||||
conf['/favicon.ico'] = {
|
||||
'tools.staticfile.on': True,
|
||||
|
|
Loading…
Add table
Reference in a new issue