swift-recon-cron: do not get confused by files in /srv/node

swift-recon-cron looks at the drives mounted in directories below
/srv/node, but before this commit, it tried to call listdir() on
everything in this directory, even if it is not a directory.

Change-Id: Id281352f7ab6ecb520eb00f3649873d8c8678608
Signed-off-by: Stefan Majewsky <stefan.majewsky@sap.com>
This commit is contained in:
Stefan Majewsky 2016-10-18 15:56:54 +02:00
parent 539c3d417c
commit 9d12575102

View File

@ -30,6 +30,8 @@ def get_async_count(device_dir, logger):
async_count = 0 async_count = 0
for i in os.listdir(device_dir): for i in os.listdir(device_dir):
device = os.path.join(device_dir, i) device = os.path.join(device_dir, i)
if not os.path.isdir(device):
continue
for asyncdir in os.listdir(device): for asyncdir in os.listdir(device):
# skip stuff like "accounts", "containers", etc. # skip stuff like "accounts", "containers", etc.
if not (asyncdir == ASYNCDIR_BASE or if not (asyncdir == ASYNCDIR_BASE or