瀏覽代碼

Avoid returning None for method `_get_symlink_target`

Daniel Vincze 5 年之前
父節點
當前提交
93ecb95862
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      coriolis/osmorphing/osmount/base.py

+ 3 - 2
coriolis/osmorphing/osmount/base.py

@@ -289,12 +289,13 @@ class BaseLinuxOSMountTools(BaseSSHOSMountTools):
         return new_mountpoints
 
     def _get_symlink_target(self, symlink):
-        target = None
+        target = symlink
         try:
             target = self._exec_cmd('readlink -en %s' % symlink).decode()
             LOG.debug("readlink %s returned: %s" % (symlink, target))
         except Exception:
-            LOG.warn('Target not found for symlink: %s' % symlink)
+            LOG.warn('Target not found for symlink: %s. Original link path '
+                     'will be returned' % symlink)
 
         return target