From c8bfaf2e061d3ee5facbc21f173915b0090e181c Mon Sep 17 00:00:00 2001 From: Matt Hicks Date: Wed, 16 Jul 2008 17:57:43 -0400 Subject: Handling multiple machines coming back from the state --- cloudmasterd/lib/cloudmasterd/syncer.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cloudmasterd/lib/cloudmasterd/syncer.rb b/cloudmasterd/lib/cloudmasterd/syncer.rb index bb191a6..4bda1a5 100644 --- a/cloudmasterd/lib/cloudmasterd/syncer.rb +++ b/cloudmasterd/lib/cloudmasterd/syncer.rb @@ -89,9 +89,11 @@ class Syncer def sync_state current_state = {} Open3.popen3("func '*' call virt state") do |stdin, stdout, stderr| - YAML.load(stdout.read).each do |host, value| - name, state = value[0].split(" ") - current_state[name] = {:state => state, :cloud => host} unless name == "Domain-0" + YAML.load(stdout.read).each do |host, machines| + machines.each do |machine| + name, state = machine.split(" ") + current_state[name] = {:state => state, :cloud => host} unless name == "Domain-0" + end end end -- cgit