fabric/fabric — pull request #872 by cournape (2013-03-22 13:36:44+00:00)
Title: Winrm support

This is a hackish/experimental attempt at playing with winrm support for Fabric.

First, some context: winrm is a set of protocol/tools to administer windows machines (think clumsy ssh replacement). The big plus for me, besides not having to install cygwin ssh, is the ability to run windows commands that do not work when run from cywgin (e.g. build using visual studio).

To use it, you need a small patch to winrm to allow for buffered output:

pip install https://github.com/cournape/pywinrm/archive/streamed_output.zip

Example:

from fabric.api import cd, winrm_run
from fabric.decorators import task

@task
def test():
with cd("C:\\"):
winrm_run("dir C:\\Windows")

The PR is obviously not in a state to be merged, but I thought I would submit it to generate some discussions:

- handling username/password. AFAIK, there is nothing like ssh-agent kind of features of winrm, but I could be wrong.
- from a user POV, I have chosen to add a new operation, winrm_run, since I expect a lot of arguments from run not to make sense here (pty, etc...).
- there is no security here, everything goes plain text. I think it is possible to encrypt things, but I have not looked at it.
- From an internal POV, fabric code base seems to depend on ssh transport quite heavily. One issue here is how to select between different implementation of internals (wrapped command, etc...). Is there a recommended way for per-host configuration ?