]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/cephfs: tidy Mount.ls to return [] on empty dir
authorJohn Spray <john.spray@redhat.com>
Tue, 29 Mar 2016 11:08:30 +0000 (12:08 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 29 Mar 2016 11:13:15 +0000 (12:13 +0100)
Previously returned ['']

Signed-off-by: John Spray <john.spray@redhat.com>
tasks/cephfs/mount.py

index 59008c15a5c402c31947d6d3fd1eb094eea74c39..e8d66b02a958e8700c37b1515cd52727ea7a3450 100644 (file)
@@ -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):
         """