diff --git a/ec2api/api/auth.py b/ec2api/api/auth.py index b731a8e8..1aec7653 100644 --- a/ec2api/api/auth.py +++ b/ec2api/api/auth.py @@ -22,9 +22,6 @@ from oslo_log import log as logging 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', default=False, 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.""" auth_strategy = "keystone" 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() filters = [loader.get_filter(n) for n in pipeline[:-1]] app = loader.get_app(pipeline[-1]) diff --git a/ec2api/paths.py b/ec2api/paths.py index 24a7325c..0ef00af8 100644 --- a/ec2api/paths.py +++ b/ec2api/paths.py @@ -13,20 +13,12 @@ # limitations under the License. import os -import sys from oslo_config import cfg 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', - default='$pybasedir', + default='/var/lib/ec2api', help="Top-level directory for maintaining ec2api's state"), ] @@ -34,31 +26,6 @@ CONF = cfg.CONF 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): """Return an uninterpolated path relative to $state_path.""" 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) diff --git a/ec2api/service.py b/ec2api/service.py index 593afaee..dd59e265 100644 --- a/ec2api/service.py +++ b/ec2api/service.py @@ -51,9 +51,6 @@ service_opts = [ cfg.IntOpt('metadata_workers', help='Number of workers for metadata service. The default will ' '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 diff --git a/ec2api/utils.py b/ec2api/utils.py index c95c1ae9..425ed1ec 100644 --- a/ec2api/utils.py +++ b/ec2api/utils.py @@ -15,42 +15,16 @@ """Utilities and helper functions.""" -import contextlib import hashlib import hmac -import shutil -import tempfile from xml.sax import saxutils -from oslo_config import cfg 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__) -@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): """returns string that represents hash of base_str (in hex format).""" return hashlib.md5(base_str).hexdigest()