mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Importing the cmd module directly as using __salt__ fails when being called from outside of returner.
This commit is contained in:
parent
073f05adc3
commit
e3e9b862a1
@ -11,6 +11,7 @@ import re
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
import salt.modules.cmdmod as salt_cmd
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -41,7 +42,7 @@ def _available_commands( ):
|
||||
|
||||
_return = [ ]
|
||||
# Note that we append '|| :' as a unix hack to force return code to be 0.
|
||||
res = __salt__['cmd.run_all']("%s help || :" % zfs_path)
|
||||
res = salt_cmd.run_all("%s help || :" % zfs_path)
|
||||
for line in res['stderr'].splitlines( ):
|
||||
if re.match( " [a-zA-Z]", line ):
|
||||
for cmd in [ cmd.strip() for cmd in line.split( " " )[0].split( "|" ) ]:
|
||||
@ -75,10 +76,10 @@ def __virtual__():
|
||||
|
||||
# At this point use the helper commands to dynamically generate
|
||||
# functions that are available.
|
||||
#for available_cmd in _available_commands( ):
|
||||
for available_cmd in _available_commands( ):
|
||||
# Define a new function here based on avaiable_cmd.
|
||||
# Also update __func_alias__
|
||||
#log.debug( "Would create function for %s" % available_cmd )
|
||||
log.debug( "Would create function for %s" % available_cmd )
|
||||
# Use setattr( globals( ), new_func, "%_" % available_cmd )
|
||||
|
||||
def list_(*args):
|
||||
|
Loading…
Reference in New Issue
Block a user