-
-
Save kim0/e9d442661295e5bac503 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import Salt libs | |
import salt.utils | |
import salt.utils.decorators as decorators | |
import salt.modules.cmdmod as salt_cmd | |
log = logging.getLogger(__name__) | |
# Function alias to set mapping. Filled | |
# in later on. | |
__func_alias__ = {} | |
def __virtual__(): | |
''' | |
Makes sure that ZFS is available. | |
''' | |
if _check_zfs(): | |
return 'zfs' | |
return False | |
@decorators.memoize | |
def _check_zfs(): | |
''' | |
Looks to see if zfs is present on the system. | |
''' | |
kernel_module_chk = { | |
'FreeBSD' : 'ls /tmp', | |
} | |
cmd = kernel_module_chk.get(__salt__['grains.get']('kernel'),'') | |
if cmd and __salt__['cmd.retcode'](cmd) == 0: | |
# Get the path to the zfs binary. | |
return salt.utils.which('zfs') | |
else: | |
return False | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment