_device_mismatch_ignored will never be True

It will be the name of the device that has matched the regex
This commit is contained in:
Daniel Wallace 2017-02-09 09:44:26 -06:00
parent 7611698474
commit 6635a9fd3b

View file

@ -412,18 +412,19 @@ def mounted(name,
opts.remove('remount')
if real_device not in device_list:
# name matches but device doesn't - need to umount
_device_mismatch_is_ignored = False
_device_mismatch_is_ignored = None
for regex in list(device_name_regex):
for _device in device_list:
if re.match(regex, _device):
_device_mismatch_is_ignored = _device
break
if __opts__['test']:
ret['result'] = None
ret['comment'] = "An umount would have been forced " \
+ "because devices do not match. Watched: " \
+ device
elif _device_mismatch_is_ignored is True:
ret['result'] = None
elif _device_mismatch_is_ignored:
ret['result'] = True
ret['comment'] = "An umount will not be forced " \
+ "because device matched device_name_regex: " \
+ _device_mismatch_is_ignored