~rcj/charm-helpers/lp1370053

Viewing all changes in revision 206.

  • Committer: Robert Jennings
  • Date: 2014-09-16 13:15:34 UTC
  • Revision ID: robert.jennings@canonical.com-20140916131534-9fxiin6hapoqwxlf
storage.linux.util: Fix swapped is_device_mounted regex logic

The is_device_mounted() function checks if the passed device is a
partition and tailors the regex based on this.  However, the search
expressions were swapped and would fail.  When a partition is provided,
a match will only be found if the parent device is mounted.

For example, if we call is_device_mounted(device='/dev/sda1') and
'/dev/sda1' is in the mount command output, the result is false.
Similarly, is_device_mounted(device='/dev/sda') and '/dev/sda' is in 
the mount command output, the result is false.  Instead, if the device
is /dev/sda1 and /dev/sda is in the mount output, we get a True result
from the function.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: