remove unused configuration options

api_rate_limit, bindir, pybasedir, service_down_time, tempdir
 was removed

Change-Id: I72389d3ea4bb0685a0862bfe765ab20b78637648
This commit is contained in:
tikitavi 2017-09-26 14:06:13 +03:00
parent 32eedd8a5c
commit 22af51cc1c
4 changed files with 1 additions and 69 deletions

View File

@ -22,9 +22,6 @@ from oslo_log import log as logging
auth_opts = [ auth_opts = [
cfg.BoolOpt('api_rate_limit',
default=False,
help='whether to use per-user rate limiting for the api.'),
cfg.BoolOpt('use_forwarded_for', cfg.BoolOpt('use_forwarded_for',
default=False, default=False,
help='Treat X-Forwarded-For as the canonical remote address. ' help='Treat X-Forwarded-For as the canonical remote address. '
@ -41,9 +38,6 @@ def pipeline_factory(loader, global_conf, **local_conf):
"""A paste pipeline replica that keys off of auth_strategy.""" """A paste pipeline replica that keys off of auth_strategy."""
auth_strategy = "keystone" auth_strategy = "keystone"
pipeline = local_conf[auth_strategy] pipeline = local_conf[auth_strategy]
if not CONF.api_rate_limit:
limit_name = auth_strategy + '_nolimit'
pipeline = local_conf.get(limit_name, pipeline)
pipeline = pipeline.split() pipeline = pipeline.split()
filters = [loader.get_filter(n) for n in pipeline[:-1]] filters = [loader.get_filter(n) for n in pipeline[:-1]]
app = loader.get_app(pipeline[-1]) app = loader.get_app(pipeline[-1])

View File

@ -13,20 +13,12 @@
# limitations under the License. # limitations under the License.
import os import os
import sys
from oslo_config import cfg from oslo_config import cfg
path_opts = [ path_opts = [
cfg.StrOpt('pybasedir',
default=os.path.abspath(os.path.join(os.path.dirname(__file__),
'../')),
help='Directory where the ec2api python module is installed'),
cfg.StrOpt('bindir',
default=os.path.join(sys.prefix, 'local', 'bin'),
help='Directory where ec2api binaries are installed'),
cfg.StrOpt('state_path', cfg.StrOpt('state_path',
default='$pybasedir', default='/var/lib/ec2api',
help="Top-level directory for maintaining ec2api's state"), help="Top-level directory for maintaining ec2api's state"),
] ]
@ -34,31 +26,6 @@ CONF = cfg.CONF
CONF.register_opts(path_opts) CONF.register_opts(path_opts)
def basedir_def(*args):
"""Return an uninterpolated path relative to $pybasedir."""
return os.path.join('$pybasedir', *args)
def bindir_def(*args):
"""Return an uninterpolated path relative to $bindir."""
return os.path.join('$bindir', *args)
def state_path_def(*args): def state_path_def(*args):
"""Return an uninterpolated path relative to $state_path.""" """Return an uninterpolated path relative to $state_path."""
return os.path.join('$state_path', *args) return os.path.join('$state_path', *args)
def basedir_rel(*args):
"""Return a path relative to $pybasedir."""
return os.path.join(CONF.pybasedir, *args)
def bindir_rel(*args):
"""Return a path relative to $bindir."""
return os.path.join(CONF.bindir, *args)
def state_path_rel(*args):
"""Return a path relative to $state_path."""
return os.path.join(CONF.state_path, *args)

View File

@ -51,9 +51,6 @@ service_opts = [
cfg.IntOpt('metadata_workers', cfg.IntOpt('metadata_workers',
help='Number of workers for metadata service. The default will ' help='Number of workers for metadata service. The default will '
'be the number of CPUs available.'), 'be the number of CPUs available.'),
cfg.IntOpt('service_down_time',
default=60,
help='Maximum time since last check-in for up service'),
] ]
CONF = cfg.CONF CONF = cfg.CONF

View File

@ -15,42 +15,16 @@
"""Utilities and helper functions.""" """Utilities and helper functions."""
import contextlib
import hashlib import hashlib
import hmac import hmac
import shutil
import tempfile
from xml.sax import saxutils from xml.sax import saxutils
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
utils_opts = [
cfg.StrOpt('tempdir',
help='Explicitly specify the temporary working directory'),
]
CONF = cfg.CONF
CONF.register_opts(utils_opts)
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@contextlib.contextmanager
def tempdir(**kwargs):
argdict = kwargs.copy()
if 'dir' not in argdict:
argdict['dir'] = CONF.tempdir
tmpdir = tempfile.mkdtemp(**argdict)
try:
yield tmpdir
finally:
try:
shutil.rmtree(tmpdir)
except OSError as e:
LOG.error('Could not remove tmpdir: %s', str(e))
def get_hash_str(base_str): def get_hash_str(base_str):
"""returns string that represents hash of base_str (in hex format).""" """returns string that represents hash of base_str (in hex format)."""
return hashlib.md5(base_str).hexdigest() return hashlib.md5(base_str).hexdigest()