]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk-prepare: use os.path.realpath()
authorSage Weil <sage@inktank.com>
Tue, 5 Mar 2013 00:08:15 +0000 (16:08 -0800)
committerSage Weil <sage@inktank.com>
Fri, 26 Apr 2013 20:40:03 +0000 (13:40 -0700)
My janky symlink resolution is broken in various ways.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 59505546e52a175435881b431bd349d532ae627e)

src/ceph-disk-prepare

index b0f003b6e5c86c649d036758aca7213ddc21d526..0eca7c0cafb822ecc16472874590e37963b1c8d1 100755 (executable)
@@ -75,13 +75,7 @@ def is_partition(dev):
     """
     Check whether a given device is a partition or a full disk.
     """
-    # resolve symlink(s)
-    max = 10
-    while stat.S_ISLNK(os.lstat(dev).st_mode):
-        dev = os.readlink(dev)
-        max -= 1
-        if max == 0:
-            raise PrepareError('%s is a rats nest of symlinks' % dev)
+    dev = os.path.realpath(dev)
     if not stat.S_ISBLK(os.lstat(dev).st_mode):
         raise PrepareError('not a block device', dev)