Added logging initialization to the global manager
This commit is contained in:
parent
552a1efb03
commit
2c7a6ac26e
@ -143,6 +143,12 @@ def start():
|
||||
"""
|
||||
config = read_and_validate_config([DEFAILT_CONFIG_PATH, CONFIG_PATH],
|
||||
REQUIRED_FIELDS)
|
||||
|
||||
common.init_logging(
|
||||
config['log_directory'],
|
||||
'global-manager.log',
|
||||
int(config['log_level']))
|
||||
|
||||
bottle.debug(True)
|
||||
bottle.app().state = {
|
||||
'config': config,
|
||||
@ -162,9 +168,9 @@ def get_params(request):
|
||||
:type request: *
|
||||
|
||||
:return: The request data dictionary.
|
||||
:rtype: map(str: str)
|
||||
:rtype: dict(str: str)
|
||||
"""
|
||||
return request.forms
|
||||
return dict(request.forms)
|
||||
|
||||
|
||||
@bottle.put('/')
|
||||
|
@ -20,6 +20,7 @@ from hashlib import sha1
|
||||
from novaclient.v1_1 import client
|
||||
|
||||
import neat.globals.manager as manager
|
||||
import neat.common as common
|
||||
|
||||
import logging
|
||||
logging.disable(logging.CRITICAL)
|
||||
@ -113,16 +114,20 @@ class GlobalManager(TestCase):
|
||||
with MockTransaction:
|
||||
app = mock('app')
|
||||
state = {'property': 'value'}
|
||||
config = {'global_manager_host': 'localhost',
|
||||
'global_manager_port': 8080}
|
||||
config = {
|
||||
'log_directory': 'dir',
|
||||
'log_level': 2,
|
||||
'global_manager_host': 'localhost',
|
||||
'global_manager_port': 8080}
|
||||
paths = [manager.DEFAILT_CONFIG_PATH, manager.CONFIG_PATH]
|
||||
fields = manager.REQUIRED_FIELDS
|
||||
expect(manager).read_and_validate_config(paths, fields). \
|
||||
and_return(config).once()
|
||||
expect(manager).init_state(config). \
|
||||
and_return(state).once()
|
||||
expect(bottle).app().and_return(app).once()
|
||||
expect(bottle).run(host='localhost', port=8080).once()
|
||||
when(manager).read_and_validate_config(paths, fields). \
|
||||
and_return(config)#.once()
|
||||
expect(common).init_logging('dir', 'global-manager.log', 2).once()
|
||||
when(manager).init_state(config). \
|
||||
and_return(state)#.once()
|
||||
when(bottle).app().and_return(app)#.once()
|
||||
when(bottle).run(host='localhost', port=8080)#.once()
|
||||
manager.start()
|
||||
|
||||
def test_init_state(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user