Add pep8 job for venus

Add openstack-python-jobs templete to have a check with pep8 job.

Change-Id: Ifc869f68141305919304e0d7af1ca66b7b2dd1ca
This commit is contained in:
zhangbailin 2020-11-11 08:56:17 +00:00
parent 3fc70be8b2
commit 417cf0a1a6
4 changed files with 20 additions and 12 deletions

View File

@ -1,3 +1,9 @@
- project: - project:
templates: templates:
- noop-jobs - openstack-python-jobs
check:
jobs:
- openstack-tox-pep8
gate:
jobs:
- openstack-tox-pep8

View File

@ -372,14 +372,19 @@ def load_standard_extensions(ext_mgr, logger, path, package, ext_list=None):
def extension_authorizer(api_name, extension_name): def extension_authorizer(api_name, extension_name):
def authorize(context, target=None, action=None): def authorize(context, target=None, action=None):
if target is None: """if target is None:
target = {'project_id': context.project_id, target = {'project_id': context.project_id,
'user_id': context.user_id} 'user_id': context.user_id}
if action is None: if action is None:
act = '%s_extension:%s' % (api_name, extension_name) act = '%s_extension:%s' % (api_name, extension_name)
else: else:
act = '%s_extension:%s:%s' % (api_name, extension_name, action) act = '%s_extension:%s:%s' % (api_name, extension_name, action)
#venus.policy.enforce(context, act, target) # venus.policy.enforce(context, act, target)
"""
pass
return authorize return authorize

View File

@ -29,7 +29,6 @@ from oslo_utils import excutils
from venus import exception from venus import exception
from venus import i18n from venus import i18n
from venus.i18n import _, _LE, _LI from venus.i18n import _, _LE, _LI
from venus.objects import base as objects_base
from venus import utils from venus import utils
from venus.wsgi import common as wsgi from venus.wsgi import common as wsgi
@ -66,7 +65,7 @@ def wrap_check_policy(func):
def check_policy(context, action, target_obj=None): def check_policy(context, action, target_obj=None):
target = { """target = {
'project_id': context.project_id, 'project_id': context.project_id,
'user_id': context.user_id, 'user_id': context.user_id,
} }
@ -78,6 +77,9 @@ def check_policy(context, action, target_obj=None):
target.update(target_obj or {}) target.update(target_obj or {})
_action = 'venus:%s' % action _action = 'venus:%s' % action
#venus.policy.enforce(context, _action, target) #venus.policy.enforce(context, _action, target)
"""
pass
class Request(webob.Request): class Request(webob.Request):

View File

@ -22,7 +22,6 @@ import random
from oslo_concurrency import processutils from oslo_concurrency import processutils
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_service import loopingcall from oslo_service import loopingcall
from oslo_service import service from oslo_service import service
from oslo_utils import importutils from oslo_utils import importutils
@ -33,7 +32,6 @@ import osprofiler.web
from venus import context from venus import context
from venus import exception from venus import exception
from venus.i18n import _, _LI, _LW from venus.i18n import _, _LI, _LW
from venus.objects import base as objects_base
from venus import version from venus import version
from venus.wsgi import common as wsgi_common from venus.wsgi import common as wsgi_common
from venus.wsgi import eventlet_server as wsgi from venus.wsgi import eventlet_server as wsgi
@ -101,8 +99,6 @@ class Service(service.Service):
*args, **kwargs): *args, **kwargs):
super(Service, self).__init__() super(Service, self).__init__()
self.host = host self.host = host
self.binary = binary self.binary = binary
self.topic = topic self.topic = topic
@ -129,11 +125,10 @@ class Service(service.Service):
self.manager.init_host() self.manager.init_host()
LOG.debug("Creating RPC server for service %s", self.topic) LOG.debug("Creating RPC server for service %s", self.topic)
target = messaging.Target(topic=self.topic, server=self.host) # target = messaging.Target(topic=self.topic, server=self.host)
endpoints = [self.manager] endpoints = [self.manager]
endpoints.extend(self.manager.additional_endpoints) endpoints.extend(self.manager.additional_endpoints)
serializer = objects_base.VenusObjectSerializer() # serializer = objects_base.VenusObjectSerializer()
self.manager.init_host_with_rpc() self.manager.init_host_with_rpc()