cloudify 自定义工作流缺少 cloudify_agent 运行时信息

cloudify custom workflow missing cloudify_agent runtime information

我想用我自己的插件在 cloudify 中开发名为 "backup" 的工作流程,但是当我 运行 该工作流程时,出现了以下错误

'backup' workflow execution failed: RuntimeError: Workflow failed: Task failed 'script_runner.tasks.run' -> Missing cloudify_agent runtime information. This most likely means that the Compute node never started successfully

我不明白为什么,有人能解决我这个问题吗? 这是我的主要蓝图代码和插件代码

我的主要蓝图

tosca_definitions_version: cloudify_dsl_1_2

imports:
  - plugins/backup.yaml
  - types/types.yaml

node_templates:

  mynode:
    type: cloudify.nodes.Compute
    properties:
      ip: "ip"
      agent_config:
        install_method: none
        user: "user"
        key: "key_uri"

  myapp:
    type: cloudify.nodes.ApplicationModule
    interfaces:
      test_platform_backup:
        backup:
          implementation: scripts/backup.sh
          inputs:
            port: 6969
        post_backup:
          implementation: scripts/post_backup.sh
    relationships:
      - type: cloudify.relationships.contained_in
        target: mynode

我的插件代码:

from cloudify.decorators import workflow
from cloudify.workflows import ctx
from cloudify.workflows.tasks_graph import forkjoin

@workflow
def backup(operation, type_name, operation_kwargs, is_node_operation, **kwargs):
    graph = ctx.graph_mode()

    send_event_starting_tasks = {}
    send_event_done_tasks = {}

    for node in ctx.nodes:
        if type_name in node.type_hierarchy:
            for instance in node.instances:
                send_event_starting_tasks[instance.id] = instance.send_event('Starting to run operation')
                send_event_done_tasks[instance.id] = instance.send_event('Done running operation')

    for node in ctx.nodes:
        if type_name in node.type_hierarchy:
            for instance in node.instances:

                sequence = graph.sequence()

                if is_node_operation:
                    operation_task = instance.execute_operation(operation, kwargs=operation_kwargs)
                else:
                    forkjoin_tasks = []
                    for relationship in instance.relationships:
                        forkjoin_tasks.append(relationship.execute_source_operation(operation))
                        forkjoin_tasks.append(relationship.execute_target_operation(operation))
                    operation_task = forkjoin(*forkjoin_tasks)

                sequence.add(
                    send_event_starting_tasks[instance.id],
                    operation_task,
                    send_event_done_tasks[instance.id])

    for node in ctx.nodes:
        for instance in node.instances:
            for rel in instance.relationships:

                instance_starting_task = send_event_starting_tasks.get(instance.id)
                target_done_task = send_event_done_tasks.get(rel.target_id)

                if instance_starting_task and target_done_task:
                    graph.add_dependency(instance_starting_task, target_done_task)

    return graph.execute()

您的虚拟机似乎没有启动。

从你的代码中我无法理解你想要做什么。 您没有安装和代理,也没有与 VM 的结构连接,但您正在尝试 运行 在 VM 上进行操作。

您应该安装一个代理,例如删除 "install_method: none",或者添加到 VM 的结构连接和 运行 使用它的操作。