diff --git a/bin/swift-recon-cron b/bin/swift-recon-cron index 8b3450b1a2..3c939a1b22 100755 --- a/bin/swift-recon-cron +++ b/bin/swift-recon-cron @@ -20,9 +20,8 @@ import os import sys from gettext import gettext as _ -from six.moves.configparser import ConfigParser -from swift.common.utils import get_logger, dump_recon_cache +from swift.common.utils import get_logger, dump_recon_cache, readconf from swift.obj.diskfile import ASYNCDIR_BASE @@ -46,17 +45,13 @@ def get_async_count(device_dir, logger): def main(): - c = ConfigParser() try: conf_path = sys.argv[1] except Exception: print("Usage: %s CONF_FILE" % sys.argv[0].split('/')[-1]) print("ex: swift-recon-cron /etc/swift/object-server.conf") sys.exit(1) - if not c.read(conf_path): - print("Unable to read config file %s" % conf_path) - sys.exit(1) - conf = dict(c.items('filter:recon')) + conf = readconf(conf_path, 'filter:recon') device_dir = conf.get('devices', '/srv/node') recon_cache_path = conf.get('recon_cache_path', '/var/cache/swift') recon_lock_path = conf.get('recon_lock_path', '/var/lock')