Fix disk.usage beacon on Windows

As documented the drive should be designated as C:\\. A recent PR 50188
changed the behavior to work with C:\, which was causing the documented
syntax to fail.

This change allows either syntax C:\ or C:\\
This commit is contained in:
twangboy 2019-02-25 12:32:51 -07:00
parent c1ab63dd45
commit 48ae8c63bd
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB

View file

@ -97,7 +97,11 @@ def beacon(config):
mount_re = '{0}$'.format(mount)
if salt.utils.platform.is_windows():
mount_re = re.sub('\\$', '\\\\', mount_re)
# mount_re comes in formatted with a $ at the end
# can be `C:\\$` or `C:\\\\$`
# re string must be like `C:\\\\` regardless of \\ or \\\\
mount_re = re.sub(r':\\\$', r':\\\\', mount_re)
mount_re = re.sub(r':\\\\\$', r':\\\\', mount_re)
for part in parts:
if re.match(mount_re, part.mountpoint):