update CONF import location

Change-Id: I2ae16ef806dbd7cb2cecf6ba675a0aa5582aaa02
This commit is contained in:
jiasirui 2020-12-24 10:36:14 +08:00
parent 4e352c54d2
commit 9e2917c0b7
10 changed files with 34 additions and 63 deletions

View File

@ -12,12 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from oslo_log import log as logging
import paste.urlmap
from venus.conf import CONF
CONF = cfg.CONF
LOG = logging.getLogger(__name__)

View File

@ -16,32 +16,17 @@ import os
import re
import enum
from oslo_config import cfg
from oslo_log import log as logging
from six.moves import urllib
import webob
from venus.api.openstack import wsgi
from venus.api import xmlutil
from venus.conf import CONF
from venus.i18n import _
from venus import utils
api_common_opts = [
cfg.IntOpt('osapi_max_limit',
default=1000,
help='The maximum number of items that a collection '
'resource returns in a single response'),
cfg.StrOpt('osapi_venus_base_URL',
default=None,
help='Base URL that will be presented to users in links '
'to the OpenStack Venus API',
deprecated_name='osapi_compute_link_prefix'),
]
CONF = cfg.CONF
CONF.register_opts(api_common_opts)
LOG = logging.getLogger(__name__)
XML_NS_V1 = 'https://www.openstack.org/mediawiki/Venus/1.0/content'

View File

@ -18,13 +18,12 @@ It can't be called 'extensions' because that causes namespacing problems.
"""
from oslo_config import cfg
from oslo_log import log as logging
from venus.api import extensions
from venus.conf import CONF
CONF = cfg.CONF
LOG = logging.getLogger(__name__)

View File

@ -13,7 +13,6 @@
# under the License.
import os
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
import webob.dec
@ -21,12 +20,11 @@ import webob.exc
from venus.api.openstack import wsgi
from venus.api import xmlutil
from venus.conf import CONF
from venus import exception
from venus.i18n import _LE, _LI, _LW
CONF = cfg.CONF
LOG = logging.getLogger(__name__)

View File

@ -20,7 +20,6 @@ Common Auth Middleware.
import os
from oslo_config import cfg
from oslo_log import log as logging
from oslo_middleware import request_id
from oslo_serialization import jsonutils
@ -28,20 +27,12 @@ import webob.dec
import webob.exc
from venus.api.openstack import wsgi
from venus.conf import CONF
from venus import context
from venus.i18n import _
from venus.wsgi import common as base_wsgi
use_forwarded_for_opt = cfg.BoolOpt(
'use_forwarded_for',
default=False,
help='Treat X-Forwarded-For as the canonical remote address. '
'Only enable this if you have a sanitizing proxy.')
CONF = cfg.CONF
CONF.register_opt(use_forwarded_for_opt)
LOG = logging.getLogger(__name__)

View File

@ -18,20 +18,10 @@ Compatibility shim for Kilo, while operators migrate to oslo.middleware.
"""
from oslo_config import cfg
from oslo_log import versionutils
from oslo_middleware import sizelimit
# Default request size is 112k
max_request_body_size_opt = cfg.IntOpt('osapi_max_request_body_size',
default=114688,
help='Max size for body of a request')
CONF = cfg.CONF
CONF.register_opt(max_request_body_size_opt)
@versionutils.deprecated(as_of=versionutils.deprecated.KILO,
in_favor_of='oslo_middleware.RequestBodySizeLimiter')
class RequestBodySizeLimiter(sizelimit.RequestBodySizeLimiter):

View File

@ -15,20 +15,7 @@
import copy
import os
from oslo_config import cfg
versions_opts = [
cfg.StrOpt('public_endpoint', default=None,
help="Public url to use for versions endpoint. The default "
"is None, which will use the request's host_url "
"attribute to populate the URL base. If Venus is "
"operating behind a proxy, you will want to change "
"this to represent the proxy's URL."),
]
CONF = cfg.CONF
CONF.register_opts(versions_opts)
from venus.conf import CONF
def get_view_builder(req):

View File

@ -149,7 +149,30 @@ global_opts = [
'Venus internal tenant.'),
cfg.StrOpt('db_driver',
default='venus.db',
help='Driver to use for database access')
help='Driver to use for database access'),
cfg.BoolOpt('use_forwarded_for',
default=False,
help='Treat X-Forwarded-For as the canonical remote address. '
'Only enable this if you have a sanitizing proxy.'),
# Default request size is 112k
cfg.IntOpt('osapi_max_request_body_size',
default=114688,
help='Max size for body of a request'),
cfg.StrOpt('public_endpoint', default=None,
help="Public url to use for versions endpoint. The default "
"is None, which will use the request's host_url "
"attribute to populate the URL base. If Venus is "
"operating behind a proxy, you will want to change "
"this to represent the proxy's URL."),
cfg.IntOpt('osapi_max_limit',
default=1000,
help='The maximum number of items that a collection '
'resource returns in a single response'),
cfg.StrOpt('osapi_venus_base_URL',
default=None,
help='Base URL that will be presented to users in links '
'to the OpenStack Venus API',
deprecated_name='osapi_compute_link_prefix'),
]

View File

@ -17,10 +17,10 @@
import os
import threading
from oslo_config import cfg
from oslo_db import options
from stevedore import driver
from venus.conf import CONF
from venus.db.sqlalchemy import api as db_api
INIT_VERSION = 000
@ -28,7 +28,7 @@ INIT_VERSION = 000
_IMPL = None
_LOCK = threading.Lock()
options.set_defaults(cfg.CONF)
options.set_defaults(CONF)
MIGRATE_REPO_PATH = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
@ -44,7 +44,7 @@ def get_backend():
if _IMPL is None:
_IMPL = driver.DriverManager(
"venus.database.migration_backend",
cfg.CONF.database.backend).driver
CONF.database.backend).driver
return _IMPL

View File

@ -17,16 +17,15 @@
import sys
import warnings
from oslo_config import cfg
from oslo_db import options
from oslo_log import log as logging
from venus.conf import CONF
from venus.db.common import _create_facade_lazily
from venus import exception
from venus.i18n import _
CONF = cfg.CONF
CONF.import_group("profiler", "venus.service")
log = logging.getLogger(__name__)
options.set_defaults(CONF, connection='sqlite:///$state_path/venus.sqlite')