Python fabric.api.env.use_ssh_config() Examples
The following are 1
code examples of fabric.api.env.use_ssh_config().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
fabric.api.env
, or try the search function
.
Example #1
Source File: utils.py From commcare-cloud with BSD 3-Clause "New" or "Revised" License | 6 votes |
def run_command(self, hosts, parallel_pool_size=1): from fabric.api import execute, sudo, env, parallel if env.ssh_config_path and os.path.isfile(os.path.expanduser(env.ssh_config_path)): env.use_ssh_config = True env.forward_agent = True # pass `-E` to sudo to preserve environment for ssh agent forwarding env.sudo_prefix = "sudo -SE -p '%(sudo_prompt)s' " env.user = self.user_name env.password = self.password env.hosts = hosts env.warn_only = True def _task(): result = sudo(self.command, user=self.user_as) return result task = _task if parallel_pool_size > 1: task = parallel(pool_size=parallel_pool_size)(_task) res = execute(task) return res