Merge "Adding more logging around containers & consumers"

This commit is contained in:
Jenkins
2015-04-30 18:58:49 +00:00
committed by Gerrit Code Review
4 changed files with 32 additions and 3 deletions

View File

@@ -35,6 +35,7 @@ from barbican.api.controllers import transportkeys
from barbican.api.controllers import versions from barbican.api.controllers import versions
from barbican.api import hooks from barbican.api import hooks
from barbican.common import config from barbican.common import config
from barbican import i18n as u
from barbican.model import repositories from barbican.model import repositories
from barbican import queue from barbican import queue
@@ -93,6 +94,10 @@ def create_main_app(global_config, **local_conf):
if newrelic_loaded: if newrelic_loaded:
wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app) wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app)
LOG = log.getLogger(__name__)
LOG.info(u._LI('Barbican app created and initialized'))
return wsgi_app return wsgi_app

View File

@@ -57,6 +57,9 @@ class ContainerConsumerController(controllers.ACLMixin):
dict_fields = consumer.to_dict_fields() dict_fields = consumer.to_dict_fields()
LOG.info(u._LI('Retrieved a consumer for project: %s'),
external_project_id)
return hrefs.convert_to_hrefs( return hrefs.convert_to_hrefs(
hrefs.convert_to_hrefs(dict_fields) hrefs.convert_to_hrefs(dict_fields)
) )
@@ -116,6 +119,8 @@ class ContainerConsumersController(controllers.ACLMixin):
) )
resp_ctrs_overall.update({'total': total}) resp_ctrs_overall.update({'total': total})
LOG.info(u._LI('Retrieved a consumer list for project: %s'),
external_project_id)
return resp_ctrs_overall return resp_ctrs_overall
@index.when(method='POST', template='json') @index.when(method='POST', template='json')
@@ -142,6 +147,9 @@ class ContainerConsumersController(controllers.ACLMixin):
url = hrefs.convert_consumer_to_href(new_consumer.container_id) url = hrefs.convert_consumer_to_href(new_consumer.container_id)
pecan.response.headers['Location'] = url pecan.response.headers['Location'] = url
LOG.info(u._LI('Created a consumer for project: %s'),
external_project_id)
return self._return_container_data(self.container_id, return self._return_container_data(self.container_id,
external_project_id) external_project_id)
@@ -168,8 +176,14 @@ class ContainerConsumersController(controllers.ACLMixin):
except exception.NotFound: except exception.NotFound:
LOG.exception(u._LE('Problem deleting consumer')) LOG.exception(u._LE('Problem deleting consumer'))
_consumer_not_found() _consumer_not_found()
return self._return_container_data(self.container_id,
external_project_id) ret_data = self._return_container_data(
self.container_id,
external_project_id
)
LOG.info(u._LI('Deleted a consumer for project: %s'),
external_project_id)
return ret_data
def _return_container_data(self, container_id, external_project_id): def _return_container_data(self, container_id, external_project_id):
try: try:

View File

@@ -66,6 +66,8 @@ class ContainerController(controllers.ACLMixin):
for secret_ref in dict_fields['secret_refs']: for secret_ref in dict_fields['secret_refs']:
hrefs.convert_to_hrefs(secret_ref) hrefs.convert_to_hrefs(secret_ref)
LOG.info(u._LI('Retrieved container for project: %s'),
external_project_id)
return hrefs.convert_to_hrefs( return hrefs.convert_to_hrefs(
hrefs.convert_to_hrefs(dict_fields) hrefs.convert_to_hrefs(dict_fields)
) )
@@ -88,6 +90,9 @@ class ContainerController(controllers.ACLMixin):
LOG.exception(u._LE('Problem deleting container')) LOG.exception(u._LE('Problem deleting container'))
container_not_found() container_not_found()
LOG.info(u._LI('Deleted container for project: %s'),
external_project_id)
for consumer in container_consumers[0]: for consumer in container_consumers[0]:
try: try:
self.consumer_repo.delete_entity_by_id( self.consumer_repo.delete_entity_by_id(
@@ -154,6 +159,7 @@ class ContainersController(controllers.ACLMixin):
) )
resp_ctrs_overall.update({'total': total}) resp_ctrs_overall.update({'total': total})
LOG.info(u._LI('Retrieved container list for project: %s'), project_id)
return resp_ctrs_overall return resp_ctrs_overall
@index.when(method='POST', template='json') @index.when(method='POST', template='json')
@@ -195,5 +201,7 @@ class ContainersController(controllers.ACLMixin):
pecan.response.status = 201 pecan.response.status = 201
pecan.response.headers['Location'] = url pecan.response.headers['Location'] = url
LOG.info(u._LI('Created a container for project: %s'),
external_project_id)
return {'container_ref': url} return {'container_ref': url}

View File

@@ -32,7 +32,9 @@ class VersionController(object):
@index.when(method='GET', template='json') @index.when(method='GET', template='json')
@controllers.handle_exceptions(u._('Version retrieval')) @controllers.handle_exceptions(u._('Version retrieval'))
def on_get(self): def on_get(self):
return { body = {
'v1': 'current', 'v1': 'current',
'build': version.__version__ 'build': version.__version__
} }
LOG.info(u._LI('Retrieved version'))
return body