- mounted_locations = mounts.get(realpath, [])
-
- if destination:
- return destination in mounted_locations
- return mounted_locations != []
+ # plain mounts
+ plain_dev_mounts = plain_mounts.get(dev, [])
+ realpath_dev_mounts = plain_mounts.get(realpath_dev, [])
+ # realpath mounts
+ plain_dev_real_mounts = realpath_mounts.get(dev, [])
+ realpath_dev_real_mounts = realpath_mounts.get(realpath_dev, [])
+
+ mount_locations = [
+ plain_dev_mounts,
+ realpath_dev_mounts,
+ plain_dev_real_mounts,
+ realpath_dev_real_mounts
+ ]
+
+ for mounts in mount_locations:
+ if mounts: # we have a matching mount
+ if destination:
+ if destination in mounts:
+ logger.info(
+ '%s detected as mounted, exists at destination: %s', dev, destination
+ )
+ return True
+ else:
+ logger.info('%s was found as mounted')
+ return True
+ logger.info('%s was not found as mounted')
+ return False