Fix repeated unnecessarily 'os.makedirs()' in test_recon_cron.py

Return value instead of sys.exit() if an exception occurs

RelatedChange: I4ca91e3b519a99f3096b95b286779a183e936eb7
Change-Id: I9ebbf5b9f4216c3eab5ab42a0014a750ca28980b
This commit is contained in:
kim woo seok 2023-09-23 23:32:09 +09:00
parent 62a9dbca76
commit bd5076ebe6
2 changed files with 2 additions and 5 deletions

View File

@ -50,7 +50,7 @@ def main():
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)
return 1
conf = readconf(conf_path, 'filter:recon')
device_dir = conf.get('devices', '/srv/node')
recon_cache_path = conf.get('recon_cache_path', DEFAULT_RECON_CACHE_PATH)
@ -70,4 +70,4 @@ def main():
msg = 'Exception during recon-cron while accessing devices'
logger.exception(msg)
print('%s: %s' % (msg, err))
sys.exit(1)
return 1

View File

@ -32,11 +32,8 @@ class TestReconCron(TestCase):
def test_get_async_count(self):
device_dir = os.path.join(self.temp_dir, 'device')
os.makedirs(device_dir)
device_index = os.path.join(device_dir, '1')
os.makedirs(device_index)
async_dir = os.path.join(device_index, ASYNCDIR_BASE)
os.makedirs(async_dir)
entry1 = os.path.join(async_dir, 'entry1')
entry2 = os.path.join(async_dir, 'entry2')
os.makedirs(entry1)