【问题标题】:Python Fabric No hosts found. Please specify with the exists functionPython Fabric 未找到主机。请用exists函数指定
【发布时间】:2015-01-09 00:05:39
【问题描述】:

我目前正在尝试运行一个小型结构脚本。运行现有结构功能时,我收到以下消息:“未找到主机。请指定...”。

我已经这样定义了我的主机:

env.roledefs.update({
            'app' : [
                'my_host',
            ],
        })

然后我调用这个函数:

@roles("app")
def update_django():
    django_dir = ...
    if exists(django_dir):

我不明白他为什么要找主人...应该感谢@roles 装饰器来定义它。

【问题讨论】:

    标签: python fabric


    【解决方案1】:

    当你使用 hosts 装饰器时它会起作用吗?

    @hosts("my_hostname")
    def update_django():
        django_dir = ...
        if exists(django_dir):
    

    你还记得所有的导入吗?

    from fabric.api import env, hosts, roles, run
    

    【讨论】:

    • 我不怕。
    • 你能告诉我你对fabric的调用是什么吗? IE。 if exists() 下面是什么:
    • 哦,其实是我的错。我的织物版本没有这个装饰器。对此感到抱歉。
    猜你喜欢
    • 1970-01-01
    • 2018-02-25
    • 2017-10-25
    • 2023-03-28
    • 2022-08-06
    • 2015-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多