from fabric import task
from fabric.connection import Connection
@task
def hello(null):
print "Hello world!"
@task
def deploy(null):
c = Connection(host='root@localhost', connect_kwargs={"password": '111111'})
c.put('fabfile.py', '/tmp/')
result = c.run('ls -l /tmp/fabfile.py')
print result.exited
fab deploy
参考官网
https://www.fabfile.org/
各版本区别
http://www.mamicode.com/info-detail-2337088.html