Merge pull request #47518 from Ch3LL/zfs_support

Fix 47364: ensure we are not caching zfs.is_supported
This commit is contained in:
Nicole Thomas 2018-05-09 09:29:06 -04:00 committed by GitHub
commit fe4e79f1de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -279,7 +279,6 @@ def _command(source, command, flags=None, opts=None,
return ' '.join(cmd)
@real_memoize
def is_supported():
'''
Check the system for ZFS support
@ -302,7 +301,7 @@ def is_supported():
on_supported_platform = True
# Additional check for the zpool command
return (_zpool_cmd() and on_supported_platform) is True
return (salt.utils.path.which('zpool') and on_supported_platform) is True
@real_memoize

View file

@ -891,6 +891,17 @@ class ZfsUtilsTestCase(TestCase):
This class contains a set of functions that test salt.utils.zfs utils
'''
## NOTE: test parameter parsing
def test_is_supported(self):
'''
Test zfs.is_supported method
'''
for value in [False, True]:
with patch('salt.utils.path.which',
MagicMock(return_value=value)):
with patch('salt.utils.platform.is_linux',
MagicMock(return_value=value)):
self.assertEqual(value, zfs.is_supported())
def test_property_data_zpool(self):
'''
Test parsing of zpool get output