From: Anirudha Bose Date: Wed, 17 Aug 2016 06:43:53 +0000 (+0530) Subject: ceph-disk: Use os.path.isabs instead of .startswith('/') X-Git-Tag: v11.0.1~300^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6f795356de00dd7c33282183b11a03da800fde7b;p=ceph-ci.git ceph-disk: Use os.path.isabs instead of .startswith('/') Signed-off-by: Anirudha Bose --- diff --git a/src/ceph-disk/ceph_disk/main.py b/src/ceph-disk/ceph_disk/main.py index fbd11db09d9..7bc1aaf1b8e 100755 --- a/src/ceph-disk/ceph_disk/main.py +++ b/src/ceph-disk/ceph_disk/main.py @@ -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