From 4f33f263ebe315ea1a4b075fd0a2cc40250e7019 Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 29 Mar 2016 12:08:30 +0100 Subject: [PATCH] tasks/cephfs: tidy Mount.ls to return [] on empty dir Previously returned [''] Signed-off-by: John Spray --- tasks/cephfs/mount.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tasks/cephfs/mount.py b/tasks/cephfs/mount.py index 59008c15a5c40..e8d66b02a958e 100644 --- a/tasks/cephfs/mount.py +++ b/tasks/cephfs/mount.py @@ -546,7 +546,15 @@ class CephFSMount(object): cmd = ["ls"] if path: cmd.append(path) - return self.run_shell(cmd).stdout.getvalue().strip().split("\n") + + ls_text = self.run_shell(cmd).stdout.getvalue().strip() + + if ls_text: + return ls_text.split("\n") + else: + # Special case because otherwise split on empty string + # gives you [''] instead of [] + return [] def getfattr(self, path, attr): """ -- 2.47.3