]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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)
committerLoic Dachary <ldachary@redhat.com>
Wed, 26 Oct 2016 09:29:40 +0000 (11:29 +0200)
Signed-off-by: Anirudha Bose <ani07nov@gmail.com>
(cherry picked from commit 6f795356de00dd7c33282183b11a03da800fde7b)

src/ceph-disk/ceph_disk/main.py

index fd60ee9b6500c2e9367e1e95e2dad6162265018c..9f4a2f03a0b019555dd9e8f30a6e804432bcb43b 100755 (executable)
@@ -382,7 +382,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:
@@ -768,7 +768,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)
@@ -3811,7 +3811,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