[英]Small library for remote command execution similar to Fabric
I currently have my own set of wrappers around Paramiko , a few functions that log the output as a command gets executed, reboot some server, transfer files, etc. However, I feel like I'm reinventing the wheel and this should already exist somewhere. 我目前在Paramiko周围有我自己的包装器,有一些函数会在执行命令时记录输出,重新启动一些服务器,传输文件等。但是,我感觉我正在重新发明轮子,并且它应该已经存在于某个地方。
I've looked into Fabric and it partially provides this, but its execution model would force me to rewrite a big part of my code, especially because it shares information about the hosts in a global variables and doesn't seem to be originally intended to be used as a library. 我已经研究了Fabric ,它提供了部分功能,但是它的执行模型会迫使我重写代码的很大一部分,特别是因为它在全局变量中共享有关主机的信息,并且似乎并非原本打算用作图书馆。
Preferably, each server should be represented by an object, so I could save state about it and run commands using something like server.run("uname -a")
, provide some basic tools like rebooting, checking for connectivity, transferring files and ideally even give me some simple way to run a command on a subset of servers in parallel. 最好,每个服务器都应该由一个对象表示,因此我可以保存它的状态并使用
server.run("uname -a")
类的命令运行命令,提供一些基本工具,例如重新启动,检查连接性,传输文件以及理想情况下甚至给我一些简单的方法来在服务器的子集上并行运行命令。
Is there already some library that provides this? 已经有一些提供此功能的库了吗?
Fabric 2.0 (currently in development) will probably be similar to what you have in mind. Fabric 2.0(当前正在开发中)可能与您所想的相似。
Have a look at https://github.com/fabric/fabric/tree/v2 看看https://github.com/fabric/fabric/tree/v2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.