fabric - 如何在部署时获取主机名

时间:2015-11-20 08:32:07

标签: python fabric

我有一个fabfile

env.hosts = [
    # huge list, 80 hostnames
]
def dm():
    with cd('/home/project/application'):
        # how to get the actual hostname here, so I can run certain commands depending on hostname?

任何想法? Fabric文档在这个方面没有给我任何帮助

1 个答案:

答案 0 :(得分:2)

您可以使用env.host访问主机名。

相关问题