mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #20530 from kim0/zfs-chk-kernel-module-2015.2
ZFS chk kernel module (fixes #12845)
This commit is contained in:
commit
757010e6cd
@ -76,14 +76,24 @@ def _exit_status(retcode):
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
Makes sure that ZFS is available.
|
||||
Makes sure that ZFS kernel module is loaded.
|
||||
'''
|
||||
if _check_zfs():
|
||||
kernel_module_chk = {
|
||||
'FreeBSD': 'kldstat -q -m zfs',
|
||||
'Linux': 'modinfo zfs',
|
||||
}
|
||||
cmd = kernel_module_chk.get(__grains__['kernel'], '')
|
||||
if cmd and salt_cmd.retcode(cmd) == 0:
|
||||
# Build dynamic functions and allow loading module
|
||||
_build_zfs_cmd_list()
|
||||
return 'zfs'
|
||||
return False
|
||||
|
||||
|
||||
def _add_doc(func, doc, prefix='\n\n '):
|
||||
'''
|
||||
Add documentation to a function
|
||||
'''
|
||||
if not func.__doc__:
|
||||
func.__doc__ = ''
|
||||
func.__doc__ += '{0}{1}'.format(prefix, doc)
|
||||
@ -124,8 +134,13 @@ def _make_function(cmd_name, doc):
|
||||
# At this point return the function we've just defined.
|
||||
return _cmd
|
||||
|
||||
# Run through all the available commands
|
||||
if _check_zfs():
|
||||
|
||||
def _build_zfs_cmd_list():
|
||||
'''
|
||||
Run through zfs command options, and build equivalent functions dynamically
|
||||
'''
|
||||
# Run through all the available commands
|
||||
if _check_zfs():
|
||||
available_cmds = _available_commands()
|
||||
for available_cmd in available_cmds:
|
||||
|
||||
@ -281,7 +296,8 @@ def list_(name='', **kwargs):
|
||||
'''
|
||||
.. versionadded:: Lithium
|
||||
|
||||
Return a list of all datasets or a specified dataset on the system and the values of their used, available, referenced, and mountpoint properties.
|
||||
Return a list of all datasets or a specified dataset on the system and the
|
||||
values of their used, available, referenced, and mountpoint properties.
|
||||
|
||||
.. note::
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user