gpt4 book ai didi

fabric - 了解 Fabric

转载 作者:行者123 更新时间:2023-12-03 20:28:06 25 4
gpt4 key购买 nike

我刚刚偶然发现Fabric并且文档并没有真正说明它是如何工作的。

我有根据的猜测是您需要在客户端和服务器端都安装它。 Python 代码存储在客户端,并在命令运行时通过 Fabric 的有线协议(protocol)传输。服务器通过 ~/.ssh/authorized_keys 接受使用 OpenSSH SSH 守护程序的连接。当前用户(或特殊用户,或在 fab 命令的主机名中指定)的文件。

这是正确的吗?如果没有,它是如何工作的?

最佳答案

从文档:

Fabric is a Python (2.5 or higher) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.

It provides a basic suite of operations for executing local or remote shell commands (normally or via sudo) and uploading/downloading files, as well as auxiliary functionality such as prompting the running user for input, or aborting execution.


所以这就像 ssh 进入一个盒子并运行你在 run() 中输入的命令。/ sudo() .
没有代码传输,因此您只需要在远程机器上运行 ssh 并拥有某种 shell(默认情况下假定为 bash)。
如果您想远程访问 python 解释器,您更多的是查看 execnet 之类的东西。 .
如果您想了解更多关于远程机器上的执行如何工作的信息,请查看 this section的文档。

关于fabric - 了解 Fabric ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6308686/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com