Starting to dynamically generate functions

This commit is contained in:
Robert Keizer 2013-05-27 20:43:55 -05:00
parent 0e6b99245f
commit 17c4f5a988

View File

@ -39,6 +39,7 @@ def _available_commands( ):
if not zfs_path: if not zfs_path:
return False return False
# TODO: Supress the ERROR log generated when we read stderr..
_return = [ ] _return = [ ]
res = __salt__['cmd.run_all']("%s help" % zfs_path) res = __salt__['cmd.run_all']("%s help" % zfs_path)
for line in res['stderr'].splitlines( ): for line in res['stderr'].splitlines( ):
@ -63,12 +64,6 @@ def _exit_status(retcode):
}[retcode] }[retcode]
return ret return ret
def test( ):
'''
Testing
'''
return _available_commands( )
def __virtual__(): def __virtual__():
''' '''
Makes sure that ZFS is available. Makes sure that ZFS is available.
@ -77,6 +72,12 @@ def __virtual__():
return 'zfs' return 'zfs'
return False return False
# At this point use the helper commands to dynamically generate
# functions that are available.
for available_cmd in _available_commands( ):
# Define a new function here based on avaiable_cmd.
# Also update __func_alias__
pass
def list_(*args): def list_(*args):
''' '''