在python脚本中启动Fab文件

2024-10-01 13:25:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个fab脚本,它工作得很好。首先,我执行以下命令:

fab -H 192.168.xx.xx deployFiles deployConfiguration:'master',7

deployFiles和{}都是my fabfile.py中的函数。'master'7deployConfiguration的参数

我有另一个Python脚本,我想启动它内部之前的fab命令。在

如何使用Python脚本中的这些参数执行fabfile?在


Tags: 函数py命令master脚本参数myfabfile
1条回答
网友
1楼 · 发布于 2024-10-01 13:25:57

你只需导入它们,然后调用它们。使用设置上下文管理器或将相关设置设置为fabric.api.env在

from fabric.context_managers import settings
from fabfile import deployFiles, deployConfiguration

with settings(host_string='user@192.168.xx.xx'):
    deployFiles()
    deployConfiguration('master', 7)

相关问题 更多 >