结构如何在部署时获取主机名

2024-05-13 12:09:08 发布

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

我有个假文件

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文档对此一无所知


Tags: 文件envprojecthomeapplicationdefwithcd