python - How to specify env.shell while in fabric.operations.execute -


i using fabric.tasks.execute execute commands on remote servers, , need use different shell depending on system. code like:

def run_test(server_ip, server_shell):     execute(test,server_ip,server_shell,host=server_ip) # host can specified in execute argument  def test(ip,shell):     env.shell=shell     run('command') 

i can live prefer execute specifing env.shell command use instead of assigning within task, that's simple , clean. can use like:

def run_test(server_ip, server_shell):     execute(test,server_ip,server_shell,host=server_ip,*shell=server_shell*) # host can specified in execute argument  def test(ip,shell):     run('command') 

execute() docs host, hosts, role, roles , exclude_hosts keyword parameters special; rest passed task i.e., shell passed test():

def test(shell):     settings(shell=shell):         run('command')  execute(test, shell=server_shell, host=server_ip) 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -