我正在尝试使用 fabric安装和部署一个 web 项目,在此期间我需要创建一个 postgresql 数据库并配置一个 RabbitMQ 服务器。这两个操作都是交互式的,需要用户输入以创建数据库、添加用户、设置密码等(至少据我所知)。
我可以使用结构脚本来执行这些交互式 shell 操作吗?
最佳答案
这是在 Fabric 1.0 中。我试过了,它对我有用。
Older versions of Fabric (and similar high level SSH libraries) run remote programs in limbo, unable to be touched from the local end. This is problematic when you have a serious need to enter passwords or otherwise interact with the remote program.
Fabric 1.0 and later breaks down this wall and ensures you can always talk to the other side.
编辑:正如 payne 在下面指出的那样,Fabric 1.0 已发布。我编辑了答案以表明这一点。
关于python - 我可以使用 Fabric 执行交互式 shell 命令吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5182857/