---
version: '2.0'
name: tripleo.parameters.v1
description: TripleO Parameter-related Workflows

workflows:
  generate_fencing_parameters:
    description: >
      This workflow will generate fencing parameters from the given inputs for
      a deployment.
    input:
      - nodes_json
      - delay
      - ipmi_level
      - ipmi_cipher
      - ipmi_lanplus
      - queue_name: tripleo

    tags:
      - tripleo-common-managed

    output:
      fencing_parameters: <% $.get('fencing_parameters', {}) %>

    tasks:
      generate_fencing_params:
        action: tripleo.parameters.generate_fencing
        input:
          nodes_json: <% $.nodes_json %>
          delay: <% $.delay %>
          ipmi_level: <% $.ipmi_level %>
          ipmi_cipher: <% $.ipmi_cipher %>
          ipmi_lanplus: <% $.ipmi_lanplus %>
        on-complete: send_message
        publish:
          fencing_parameters: <% task().result %>
          status: SUCCESS
          message: 'Fencing parameters successfully generated'
        publish-on-error:
          status: FAILED
          message: <% task().result %>

      send_message:
        workflow: tripleo.messaging.v1.send
        input:
          queue_name: <% $.queue_name %>
          type: <% execution().name %>
          status: <% $.status %>
          execution: <% execution() %>
          message: <% $.get('message', '') %>
          payload:
            fencing_parameters: <% $.get('fencing_parameters', {}) %>

