change logging

This commit is contained in:
deflax 2016-04-02 04:29:22 +03:00
parent d98ca0c5ae
commit f21cc8449d
2 changed files with 10 additions and 4 deletions

View file

@ -50,7 +50,7 @@ def sync(cached=True):
real_slave = { "id":slave_id, "slave":slave_name, "masterip":slave_masterip, "password":decoded_password }
optional_slave = {}
cache_file = 'cache-slave-' + slave_id + '.json'
prefix = 'cache> [' + slave_name + '] '
prefix = 'slave[' + slave_name + ']> '
# check if slave is in current region and include it in current dict if it is
if slave_regionid == region_id:
@ -60,7 +60,7 @@ def sync(cached=True):
proxobject = plugin.auth(slave_id, slave_masterip, enc_slave_password)
vmlist = plugin.vmlist(proxobject)
real_slave['alive'] = 'up'
logger.info(prefix + 'is up')
logger.info(prefix + 'is online')
except:
#raise
#slave cant be read so it will be marked down.
@ -342,7 +342,7 @@ def query_vm(req_vmid):
logger.error('vm[{}]> type is unknown!'.format(vm_id))
raise
logger.info('vm[{}]> type={} path={}'.format(target, vm_type, str(path)))
#logger.info('vm[{}]> type={} path={}'.format(target, vm_type, str(path)))
return slave_id, vm_type

View file

@ -19,12 +19,14 @@ import clientsdb
config = ioconfig.parser
logger = ioconfig.logger
def welcome():
"""displays motd in log as welcome message"""
logger.info('###################################')
logger.info('# proxmaster ][ (c) 2015-2016 afx #')
logger.info('###################################')
def apicheck(params):
""" compares request params for api key with the config file"""
try:
@ -43,6 +45,7 @@ def apicheck(params):
finally:
return (status, response)
#API methods
class Validate(object):
def on_post(self, req, resp):
@ -60,7 +63,6 @@ class Validate(object):
resp.body = 'ERR'
class ClusterResource(object):
def on_get(self, req, resp):
"""TEST ONLY. List cluster nodes. TEST ONLY"""
@ -91,6 +93,7 @@ class ClusterResource(object):
resp.status = falcon.HTTP_403
resp.body = apicheck_resp
class StatusResource(object):
def on_get(self, req, resp, vmid):
""" check vm status """
@ -129,6 +132,7 @@ class DeleteResource(object):
resp.status = falcon.HTTP_403
resp.body = apicheck_resp
class ArchivateResource(object):
def on_post(self, req, resp, vmid):
""" Temporary suspend the instance """
@ -148,6 +152,7 @@ class ArchivateResource(object):
resp.status = falcon.HTTP_403
resp.body = apicheck_resp
class UnArchiveResource(object):
def on_post(self, req, resp, vmid):
""" Unuspend the instance """
@ -167,6 +172,7 @@ class UnArchiveResource(object):
resp.status = falcon.HTTP_403
resp.body = apicheck_resp
class StartResource(object):
def on_post(self, req, resp, vmid):
""" Start the instance """