Add support for initial state to the register_or_update workflow

Currently, it is not possible to set nodes to an 'enroll' state. It's
either 'manageable' or 'available'. This adds support for the
initial_state to be set to something other than just available.

Change-Id: I40f0b27a0f38447372181f9fae6a31e57dbd79e4
Partial-Bug: #1637474
This commit is contained in:
Brad P. Crochet 2016-11-16 10:37:18 -05:00 committed by Dougal Matthews
parent 1a7a07b94a
commit 06197370db
1 changed files with 21 additions and 2 deletions

View File

@ -99,11 +99,14 @@ workflows:
- kernel_name: null
- ramdisk_name: null
- instance_boot_option: local
- initial_state: manageable
tasks:
register_or_update_nodes:
action: tripleo.baremetal.register_or_update_nodes
on-success: set_nodes_managed
on-success:
- set_nodes_managed: <% $.initial_state != "enroll" %>
- send_message: <% $.initial_state = "enroll" %>
on-error: set_status_failed_register_or_update_nodes
input:
nodes_json: <% $.nodes_json %>
@ -123,7 +126,9 @@ workflows:
registered_nodes: []
set_nodes_managed:
on-success: send_message
on-success:
- set_nodes_available: <% $.initial_state = "available" %>
- send_message: <% $.initial_state != "available" %>
on-error: set_status_failed_nodes_managed
with-items: node in <% $.new_nodes %>
workflow: tripleo.baremetal.v1.set_node_state node_uuid=<% $.node.uuid %> state_action='manage' target_state='manageable'
@ -137,6 +142,20 @@ workflows:
status: FAILED
message: <% task(set_nodes_managed).result %>
set_nodes_available:
on-success: send_message
on-error: set_status_failed_nodes_available
workflow: tripleo.baremetal.v1.provide node_uuids=<% $.new_nodes.uuid %> queue_name=<% $.queue_name %>
publish:
status: SUCCESS
message: Nodes set to available.
set_status_failed_nodes_available:
on-success: send_message
publish:
status: FAILED
message: <% task(set_nodes_available).result %>
send_message:
action: zaqar.queue_post
retry: count=5 delay=1