
Enables excluded pep8 checks and fixes existing the related errors Change-Id: Ib3a909d79b9726567c1cebf5881d1878d91ee052
35 lines
943 B
Python
Executable File
35 lines
943 B
Python
Executable File
"""Configuration rest API input module."""
|
|
|
|
import logging
|
|
|
|
from orm_common.utils import utils
|
|
|
|
from pecan import conf
|
|
from pecan import request
|
|
from pecan import rest
|
|
from wsmeext.pecan import wsexpose
|
|
|
|
from rms.utils import authentication
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class ConfigurationController(rest.RestController):
|
|
"""Configuration controller."""
|
|
|
|
@wsexpose(str, str, status_code=200)
|
|
def get(self, dump_to_log='false'):
|
|
"""get method.
|
|
|
|
:param dump_to_log: A boolean string that says whether the
|
|
configuration should be written to log
|
|
:return: A pretty string that contains the service's configuration
|
|
"""
|
|
logger.info("Get configuration...")
|
|
authentication.authorize(request, 'configuration:get')
|
|
|
|
dump = dump_to_log.lower() == 'true'
|
|
utils.set_utils_conf(conf)
|
|
result = utils.report_config(conf, dump, logger)
|
|
return result
|