]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-disk: Use os.path.isabs instead of .startswith('/')
authorAnirudha Bose <ani07nov@gmail.com>
Wed, 17 Aug 2016 06:43:53 +0000 (12:13 +0530)
committerAnirudha Bose <ani07nov@gmail.com>
Wed, 17 Aug 2016 07:34:32 +0000 (13:04 +0530)
Signed-off-by: Anirudha Bose <ani07nov@gmail.com>
src/ceph-disk/ceph_disk/main.py

index fbd11db09d9e2cd911f24ac5910e931e9e336748..7bc1aaf1b8eb82fc4ac64ae4e07bca030f04112c 100755 (executable)
@@ -383,7 +383,7 @@ def _get_command_executable(arguments):
     Return the full path for an executable, raise if the executable is not
     found. If the executable has already a full path do not perform any checks.
     """
-    if arguments[0].startswith('/'):  # an absolute path
+    if os.path.isabs(arguments[0]):  # an absolute path
         return arguments
     executable = which(arguments[0])
     if not executable:
@@ -753,7 +753,7 @@ def is_mounted(dev):
                 continue
             mounts_dev = fields[0]
             path = fields[1]
-            if mounts_dev.startswith('/') and os.path.exists(mounts_dev):
+            if os.path.isabs(mounts_dev) and os.path.exists(mounts_dev):
                 mounts_dev = os.path.realpath(mounts_dev)
                 if mounts_dev == dev:
                     return _bytes2str(path)
@@ -3804,7 +3804,7 @@ def is_swap(dev):
             if len(fields) < 3:
                 continue
             swaps_dev = fields[0]
-            if swaps_dev.startswith('/') and os.path.exists(swaps_dev):
+            if os.path.isabs(swaps_dev) and os.path.exists(swaps_dev):
                 swaps_dev = os.path.realpath(swaps_dev)
                 if swaps_dev == dev:
                     return True