diff --git a/bin/glance-cache-cleaner b/bin/glance-cache-cleaner index 6246714a..3fcd2614 100755 --- a/bin/glance-cache-cleaner +++ b/bin/glance-cache-cleaner @@ -47,13 +47,18 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')): gettext.install('glance', unicode=1) from glance.common import config +from glance.image_cache import cleaner +from glance.openstack.common import cfg + +CONF = cfg.CONF if __name__ == '__main__': try: config.parse_cache_args() + config.setup_logging() - app = config.load_paste_app('glance-cleaner', 'glance-cache-paste.ini') + app = cleaner.Cleaner() app.run() except RuntimeError, e: sys.exit("ERROR: %s" % e) diff --git a/bin/glance-cache-prefetcher b/bin/glance-cache-prefetcher index 9b73edfd..7948ae94 100755 --- a/bin/glance-cache-prefetcher +++ b/bin/glance-cache-prefetcher @@ -38,14 +38,18 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')): gettext.install('glance', unicode=1) from glance.common import config +from glance.image_cache import prefetcher +from glance.openstack.common import cfg + +CONF = cfg.CONF if __name__ == '__main__': try: config.parse_cache_args() + config.setup_logging() - app = config.load_paste_app('glance-prefetcher', - 'glance-cache-paste.ini') + app = prefetcher.Prefetcher() app.run() except RuntimeError, e: sys.exit("ERROR: %s" % e) diff --git a/bin/glance-cache-pruner b/bin/glance-cache-pruner index 92f0638a..62b5a981 100755 --- a/bin/glance-cache-pruner +++ b/bin/glance-cache-pruner @@ -39,13 +39,18 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')): gettext.install('glance', unicode=1) from glance.common import config +from glance.image_cache import pruner +from glance.openstack.common import cfg + +CONF = cfg.CONF if __name__ == '__main__': try: config.parse_cache_args() + config.setup_logging() - app = config.load_paste_app('glance-pruner', 'glance-cache-paste.ini') + app = pruner.Pruner() app.run() except RuntimeError, e: sys.exit("ERROR: %s" % e) diff --git a/bin/glance-scrubber b/bin/glance-scrubber index 69afcb6b..365ead9f 100755 --- a/bin/glance-scrubber +++ b/bin/glance-scrubber @@ -55,8 +55,9 @@ if __name__ == '__main__': CONF.register_opt(cfg.IntOpt('wakeup_time', default=300)) config.parse_args() + config.setup_logging() - app = config.load_paste_app('glance-scrubber') + app = scrubber.Scrubber() if CONF.daemon: server = scrubber.Daemon(CONF.wakeup_time) diff --git a/etc/glance-cache-paste.ini b/etc/glance-cache-paste.ini deleted file mode 100644 index 36b0ffc8..00000000 --- a/etc/glance-cache-paste.ini +++ /dev/null @@ -1,8 +0,0 @@ -[app:glance-pruner] -paste.app_factory = glance.image_cache.pruner:Pruner.factory - -[app:glance-prefetcher] -paste.app_factory = glance.image_cache.prefetcher:Prefetcher.factory - -[app:glance-cleaner] -paste.app_factory = glance.image_cache.cleaner:Cleaner.factory diff --git a/etc/glance-scrubber-paste.ini b/etc/glance-scrubber-paste.ini deleted file mode 100644 index 8762aa14..00000000 --- a/etc/glance-scrubber-paste.ini +++ /dev/null @@ -1,2 +0,0 @@ -[app:glance-scrubber] -paste.app_factory = glance.store.scrubber:Scrubber.factory diff --git a/glance/image_cache/base.py b/glance/image_cache/base.py index b0385c1b..eb8832cb 100644 --- a/glance/image_cache/base.py +++ b/glance/image_cache/base.py @@ -21,7 +21,3 @@ class CacheApp(object): def __init__(self): self.cache = ImageCache() - - @classmethod - def factory(cls, global_conf, **local_conf): - return cls() diff --git a/glance/store/scrubber.py b/glance/store/scrubber.py index 6f52faad..5acfdf90 100644 --- a/glance/store/scrubber.py +++ b/glance/store/scrubber.py @@ -88,10 +88,6 @@ class Scrubber(object): store.create_stores() - @classmethod - def factory(cls, global_conf, **local_conf): - return cls() - def run(self, pool, event=None): now = time.time() diff --git a/glance/tests/functional/__init__.py b/glance/tests/functional/__init__.py index b239dfd6..cf4e9dea 100644 --- a/glance/tests/functional/__init__.py +++ b/glance/tests/functional/__init__.py @@ -396,9 +396,6 @@ wakeup_time = 2 scrubber_datadir = %(scrubber_datadir)s registry_host = 0.0.0.0 registry_port = %(registry_port)s -""" - self.paste_conf_base = """[app:glance-scrubber] -paste.app_factory = glance.store.scrubber:Scrubber.factory """ diff --git a/glance/tests/functional/v1/test_bin_glance_cache_manage.py b/glance/tests/functional/v1/test_bin_glance_cache_manage.py index 4a477648..03e4b0d8 100644 --- a/glance/tests/functional/v1/test_bin_glance_cache_manage.py +++ b/glance/tests/functional/v1/test_bin_glance_cache_manage.py @@ -206,18 +206,6 @@ metadata_encryption_key = %(metadata_encryption_key)s log_file = %(log_file)s """ % cache_file_options) - with open(cache_config_filepath.replace(".conf", "-paste.ini"), - 'w') as paste_file: - paste_file.write("""[app:glance-pruner] -paste.app_factory = glance.image_cache.pruner:Pruner.factory - -[app:glance-prefetcher] -paste.app_factory = glance.image_cache.prefetcher:Prefetcher.factory - -[app:glance-cleaner] -paste.app_factory = glance.image_cache.cleaner:Cleaner.factory -""") - cmd = ("bin/glance-cache-prefetcher --config-file %s" % cache_config_filepath) diff --git a/glance/tests/functional/v1/test_cache_middleware.py b/glance/tests/functional/v1/test_cache_middleware.py index d1d24034..2be0ae76 100644 --- a/glance/tests/functional/v1/test_cache_middleware.py +++ b/glance/tests/functional/v1/test_cache_middleware.py @@ -457,18 +457,6 @@ metadata_encryption_key = %(metadata_encryption_key)s log_file = %(log_file)s """ % cache_file_options) - with open(cache_config_filepath.replace(".conf", "-paste.ini"), - 'w') as paste_file: - paste_file.write("""[app:glance-pruner] -paste.app_factory = glance.image_cache.pruner:Pruner.factory - -[app:glance-prefetcher] -paste.app_factory = glance.image_cache.prefetcher:Prefetcher.factory - -[app:glance-cleaner] -paste.app_factory = glance.image_cache.cleaner:Cleaner.factory -""") - self.verify_no_images() ids = {} diff --git a/glance/tests/unit/test_config.py b/glance/tests/unit/test_config.py index 911731b4..c0ec0cf1 100644 --- a/glance/tests/unit/test_config.py +++ b/glance/tests/unit/test_config.py @@ -96,24 +96,3 @@ class TestPasteApp(test_utils.BaseTestCase): expected_middleware = context.UnauthenticatedContextMiddleware self._do_test_load_paste_app(expected_middleware, paste_config_file=paste_config_file) - - def test_load_paste_app_with_conf_name(self): - def fake_join(*args): - if (len(args) == 2 and - args[0].endswith('.glance') and - args[1] == 'glance-cache.conf'): - return os.path.join(os.getcwd(), 'etc', args[1]) - else: - return orig_join(*args) - - orig_join = os.path.join - self.stubs.Set(os.path, 'join', fake_join) - - config.parse_cache_args([]) - - self.stubs.Set(config, 'setup_logging', lambda *a: None) - self.stubs.Set(pruner.Pruner, '__init__', lambda p: None) - - app = config.load_paste_app('glance-pruner') - - self.assertTrue(isinstance(app, pruner.Pruner))