From 20b53b88e1d58eda644da750bbaa58c0aa780163 Mon Sep 17 00:00:00 2001
From: root <root@compass2.(none)>
Date: Thu, 7 Aug 2014 15:39:58 -0700
Subject: [PATCH] fix progress update bug.

Change-Id: Ia44842231472ee821e86993b8c1e4d103eeacaad
---
 compass/actions/update_progress.py | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/compass/actions/update_progress.py b/compass/actions/update_progress.py
index 5246bd54..ed3cc736 100644
--- a/compass/actions/update_progress.py
+++ b/compass/actions/update_progress.py
@@ -84,23 +84,24 @@ def update_progress(cluster_hosts):
         os_names = {}
         distributed_systems = {}
         with database.session() as session:
-            cluster = session.query(models.Cluster).first()
-            clusterid = cluster.id
+            clusters = session.query(models.Cluster).all()
+            for cluster in clusters:
+                clusterid = cluster.id
 
-            adapter = cluster.adapter
-            os_installer = adapter.adapter_os_installer
-            os_installer_name = os_installer.instance_name
-            package_installer = adapter.adapter_package_installer
-            package_installer_name = package_installer.instance_name
+                adapter = cluster.adapter
+                os_installer = adapter.adapter_os_installer
+                os_installer_name = os_installer.instance_name
+                package_installer = adapter.adapter_package_installer
+                package_installer_name = package_installer.instance_name
 
-            distributed_system_name = cluster.distributed_system_name
-            os_name = cluster.os_name
-            os_names[clusterid] = os_name
-            distributed_systems[clusterid] = distributed_system_name
+                distributed_system_name = cluster.distributed_system_name
+                os_name = cluster.os_name
+                os_names[clusterid] = os_name
+                distributed_systems[clusterid] = distributed_system_name
 
-            clusterhosts = cluster.clusterhosts
-            hostids = [clusterhost.host.id for clusterhost in clusterhosts]
-            cluster_hosts.update({clusterid: hostids})
+                clusterhosts = cluster.clusterhosts
+                hostids = [clusterhost.host.id for clusterhost in clusterhosts]
+                cluster_hosts.update({clusterid: hostids})
 
         progress_calculator.update_progress(
             os_installer_name,