summaryrefslogtreecommitdiffstats
path: root/tests/inspector.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/inspector.py')
-rw-r--r--tests/inspector.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/inspector.py b/tests/inspector.py
index 62614158..129a386a 100644
--- a/tests/inspector.py
+++ b/tests/inspector.py
@@ -12,6 +12,7 @@ import collections
from flask import Flask
from flask import request
import json
+import logger as doctor_log
import os
import time
@@ -19,6 +20,8 @@ import novaclient.client as novaclient
import nova_force_down
+LOG = doctor_log.Logger('doctor_inspector').getLogger()
+
class DoctorInspectorSample(object):
@@ -44,9 +47,9 @@ class DoctorInspectorSample(object):
try:
host=server.__dict__.get('OS-EXT-SRV-ATTR:host')
self.servers[host].append(server)
- app.logger.debug('get hostname=%s from server=%s' % (host, server))
+ LOG.debug('get hostname=%s from server=%s' % (host, server))
except Exception as e:
- app.logger.debug('can not get hostname from server=%s' % server)
+ LOG.error('can not get hostname from server=%s' % server)
def disable_compute_host(self, hostname):
for server in self.servers[hostname]:
@@ -63,15 +66,14 @@ class DoctorInspectorSample(object):
app = Flask(__name__)
-app.debug = True
inspector = DoctorInspectorSample()
@app.route('/events', methods=['POST'])
def event_posted():
- app.logger.debug('event posted at %s' % time.time())
- app.logger.debug('inspector = %s' % inspector)
- app.logger.debug('received data = %s' % request.data)
+ LOG.info('event posted at %s' % time.time())
+ LOG.info('inspector = %s' % inspector)
+ LOG.info('received data = %s' % request.data)
d = json.loads(request.data)
hostname = d['hostname']
event_type = d['type']
@@ -91,5 +93,6 @@ def main():
args = get_args()
app.run(port=args.port)
+
if __name__ == '__main__':
main()