diff options
Diffstat (limited to 'ocata')
-rw-r--r-- | ocata/manage.py | 2 | ||||
-rw-r--r-- | ocata/ocata/celery.py | 1 | ||||
-rw-r--r-- | ocata/ocata/middleware.py | 3 | ||||
-rw-r--r-- | ocata/ocata/pub/__init__.py | 1 | ||||
-rw-r--r-- | ocata/ocata/pub/config/__init__.py | 1 | ||||
-rw-r--r-- | ocata/ocata/samples/__init__.py | 1 | ||||
-rw-r--r-- | ocata/ocata/samples/tests.py | 1 | ||||
-rw-r--r-- | ocata/ocata/settings.py | 4 | ||||
-rw-r--r-- | ocata/ocata/swagger/__init__.py | 1 | ||||
-rw-r--r-- | ocata/ocata/swagger/tests.py | 1 | ||||
-rw-r--r-- | ocata/ocata/swagger/urls.py | 2 | ||||
-rw-r--r-- | ocata/ocata/swagger/views.py | 15 | ||||
-rw-r--r-- | ocata/ocata/urls.py | 6 |
13 files changed, 13 insertions, 26 deletions
diff --git a/ocata/manage.py b/ocata/manage.py index 8eaeff12..7e19a937 100644 --- a/ocata/manage.py +++ b/ocata/manage.py @@ -3,7 +3,7 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: -# +# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software diff --git a/ocata/ocata/celery.py b/ocata/ocata/celery.py index ee533b5d..3dd5d1e5 100644 --- a/ocata/ocata/celery.py +++ b/ocata/ocata/celery.py @@ -33,6 +33,7 @@ app.autodiscover_tasks() logger = logging.getLogger(__name__) + @app.task(bind=True) def debug_task(self): logger.debug("self.request") diff --git a/ocata/ocata/middleware.py b/ocata/ocata/middleware.py index f2618e06..4f19da08 100644 --- a/ocata/ocata/middleware.py +++ b/ocata/ocata/middleware.py @@ -19,6 +19,7 @@ from onaplogging.mdcContext import MDC FORWARDED_FOR_FIELDS = ["HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED_HOST", "HTTP_X_FORWARDED_SERVER"] + class LogContextMiddleware(object): # the last IP behind multiple proxies, if no exist proxies @@ -43,7 +44,6 @@ class LogContextMiddleware(object): return ip - def process_request(self, request): # fetch propageted Id from other component. if do not fetch id, # generate one. @@ -62,4 +62,3 @@ class LogContextMiddleware(object): MDC.clear() return response - diff --git a/ocata/ocata/pub/__init__.py b/ocata/ocata/pub/__init__.py index afa702d3..ae1ce9db 100644 --- a/ocata/ocata/pub/__init__.py +++ b/ocata/ocata/pub/__init__.py @@ -11,4 +11,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - diff --git a/ocata/ocata/pub/config/__init__.py b/ocata/ocata/pub/config/__init__.py index afa702d3..ae1ce9db 100644 --- a/ocata/ocata/pub/config/__init__.py +++ b/ocata/ocata/pub/config/__init__.py @@ -11,4 +11,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - diff --git a/ocata/ocata/samples/__init__.py b/ocata/ocata/samples/__init__.py index afa702d3..ae1ce9db 100644 --- a/ocata/ocata/samples/__init__.py +++ b/ocata/ocata/samples/__init__.py @@ -11,4 +11,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - diff --git a/ocata/ocata/samples/tests.py b/ocata/ocata/samples/tests.py index b294a52b..02c59247 100644 --- a/ocata/ocata/samples/tests.py +++ b/ocata/ocata/samples/tests.py @@ -13,7 +13,6 @@ # limitations under the License. import unittest -import json from django.test import Client from rest_framework import status diff --git a/ocata/ocata/settings.py b/ocata/ocata/settings.py index 1e86178e..dd59f6bb 100644 --- a/ocata/ocata/settings.py +++ b/ocata/ocata/settings.py @@ -93,7 +93,7 @@ CACHES = { MSB_SERVICE_ADDR = os.environ.get('MSB_ADDR', "127.0.0.1") MSB_SERVICE_PORT = os.environ.get('MSB_PORT', "80") -#[Multicloud] +# [Multicloud] MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-ocata/v0" % ( MSB_SERVICE_ADDR, MSB_SERVICE_PORT) @@ -129,7 +129,7 @@ config.yamlConfig(filepath=LOGGING_FILE, watchDog=True) if 'test' in sys.argv: - #LOGGING['handlers']['ocata_handler']['filename'] = 'logs/ocata.log' + # LOGGING['handlers']['ocata_handler']['filename'] = 'logs/ocata.log' REST_FRAMEWORK = {} import platform diff --git a/ocata/ocata/swagger/__init__.py b/ocata/ocata/swagger/__init__.py index afa702d3..ae1ce9db 100644 --- a/ocata/ocata/swagger/__init__.py +++ b/ocata/ocata/swagger/__init__.py @@ -11,4 +11,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - diff --git a/ocata/ocata/swagger/tests.py b/ocata/ocata/swagger/tests.py index 323f512e..0d025966 100644 --- a/ocata/ocata/swagger/tests.py +++ b/ocata/ocata/swagger/tests.py @@ -13,7 +13,6 @@ # limitations under the License. import unittest -import json from django.test import Client from rest_framework import status diff --git a/ocata/ocata/swagger/urls.py b/ocata/ocata/swagger/urls.py index 9f12227f..dcc429ab 100644 --- a/ocata/ocata/swagger/urls.py +++ b/ocata/ocata/swagger/urls.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import patterns, url +from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns from ocata.swagger.views import SwaggerJsonView diff --git a/ocata/ocata/swagger/views.py b/ocata/ocata/swagger/views.py index 27ea3653..30536d7c 100644 --- a/ocata/ocata/swagger/views.py +++ b/ocata/ocata/swagger/views.py @@ -12,16 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import json import logging -import os -import traceback -from rest_framework import status from rest_framework.response import Response -from rest_framework.views import APIView -from common.exceptions import VimDriverNewtonException from newton_base.swagger import views as newton_json_view logger = logging.getLogger(__name__) @@ -36,14 +30,15 @@ class SwaggerJsonView(newton_json_view.SwaggerJsonView): :return: ''' - resp = super(SwaggerJsonView,self).get(request) + resp = super(SwaggerJsonView, self).get(request) json_data = resp.data if resp else None if json_data: json_data["basePath"] = "/api/multicloud-ocata/v0/" json_data["info"]["title"] = "Service NBI of MultiCloud plugin for OpenStack Ocata" return Response(data=json_data, status=200) else: - return Response(data={'error':'internal error'}, status=500) + return Response(data={'error': 'internal error'}, status=500) + class APIv1SwaggerJsonView(newton_json_view.SwaggerJsonView): @@ -54,11 +49,11 @@ class APIv1SwaggerJsonView(newton_json_view.SwaggerJsonView): :return: ''' - resp = super(APIv1SwaggerJsonView,self).get(request) + resp = super(APIv1SwaggerJsonView, self).get(request) json_data = resp.data if resp else None if json_data: json_data["basePath"] = "/api/multicloud-ocata/v1/" json_data["info"]["title"] = "Service NBI v1 of MultiCloud plugin for Ocata" return Response(data=json_data, status=200) else: - return Response(data={'error':'internal error'}, status=500) + return Response(data={'error': 'internal error'}, status=500) diff --git a/ocata/ocata/urls.py b/ocata/ocata/urls.py index a055af4a..5fb1e97e 100644 --- a/ocata/ocata/urls.py +++ b/ocata/ocata/urls.py @@ -31,9 +31,9 @@ urlpatterns = [ url(r'^api/multicloud-ocata/v0/(?P<vimid>[0-9a-zA-Z_-]+)/exten', include('ocata.extensions.urls')), url(r'^api/multicloud-ocata/v0/(?P<vimid>[0-9a-zA-Z_-]+)/', - include('ocata.proxy.urls')), + include('ocata.proxy.urls')), url(r'^api/multicloud-ocata/v0/(?P<vimid>[0-9a-zA-Z_-]+)/tenants$', - tenants.Tenants.as_view()), + tenants.Tenants.as_view()), url(r'^api/multicloud-ocata/v0/(?P<vimid>[0-9a-zA-Z_-]+)/' '(?P<tenantid>[0-9a-zA-Z_-]{20,})/', include('ocata.requests.urls')), # CapacityCheck @@ -67,5 +67,3 @@ urlpatterns = [ url(r'^api/multicloud-ocata/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/infra_workload/(?P<requri>[0-9a-zA-Z_-]*)/?$', infra_workload.APIv1InfraWorkload.as_view()), ] - - |