From 9bb2edb55759dad55719bfeb9bd0eed2615a641e Mon Sep 17 00:00:00 2001 From: Mike Scherbakov Date: Mon, 5 Aug 2013 03:30:16 +0400 Subject: [PATCH] Skip nodes for provision if they already ready/provisioned --- lib/astute/orchestrator.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/astute/orchestrator.rb b/lib/astute/orchestrator.rb index 4cb9a806..96974ce1 100644 --- a/lib/astute/orchestrator.rb +++ b/lib/astute/orchestrator.rb @@ -85,8 +85,14 @@ module Astute end end - def provision(reporter, task_id, nodes) - raise "Nodes to provision are not provided!" if nodes.empty? + def provision(reporter, task_id, nodes_up) + raise "Nodes to provision are not provided!" if nodes_up.empty? + + # We need only those which are not ready/provisioned yet + nodes = [] + nodes_up.each do |n| + nodes << n unless ['provisioned', 'ready'].include?(n['status']) + end # Following line fixes issues with uids: it should always be string nodes.map { |x| x['uid'] = x['uid'].to_s } # NOTE: perform that on environment['nodes'] initialization