
Moves unit tests under the rms directory to the root test directory Change-Id: Idcb2d89f46669772328adb175f94a8d8bfa0ecaa
32 lines
947 B
Python
Executable File
32 lines
947 B
Python
Executable File
"""Configuration rest API input module."""
|
|
|
|
import logging
|
|
|
|
from orm.common.orm_common.utils import utils
|
|
from orm.services.region_manager.rms.utils import authentication
|
|
|
|
from pecan import conf, request, rest
|
|
from wsmeext.pecan import wsexpose
|
|
|
|
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
|