commit 9b1fdc1f374e275cf8d50d531f318613a371891a
Author: Ryan McCabe <rmccabe(a)redhat.com>
Date: Mon Sep 19 16:38:06 2011 -0400
Create cluster roles properly after a delete/recreate
luci/validation/validate_create_cluster_form.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/luci/validation/validate_create_cluster_form.py
b/luci/validation/validate_create_cluster_form.py
index 209a561..d78192f 100644
--- a/luci/validation/validate_create_cluster_form.py
+++ b/luci/validation/validate_create_cluster_form.py
@@ -15,7 +15,7 @@ from luci.model.objects import Node, Cluster, Task
from luci.lib.ricci_helpers import send_batch_parallel, update_cluster_conf
from luci.lib.ricci_communicator import RicciCommunicator
-from luci.lib.db_helpers import get_node_by_host, grant_all_cluster_roles
+from luci.lib.db_helpers import get_node_by_host, grant_all_cluster_roles,
db_create_cluster_roles
from luci.lib.ClusterConf.ClusterNode import ClusterNode
import luci.lib.ricci_queries as rq
@@ -161,8 +161,7 @@ def validate_create_cluster_form(self, username, **kw):
cur_task_obj = task_db_obj.get(node_db_obj[i].hostname)
if cur_task_obj:
node_db_obj[i].tasks = [ cur_task_obj ]
- else:
- print "NO TASK OBJ FOR %s" % i
+ db_create_cluster_roles(cluster_db_obj)
DBSession.add(cluster_db_obj)
except Exception, e:
log.exception('Error updating luci DB for cluster %s' % cluster_name)
@@ -177,7 +176,8 @@ def validate_create_cluster_form(self, username, **kw):
log.exception('Error flushing DB while creating %s' % cluster_name)
try:
- grant_all_cluster_roles(username, cluster_name)
+ if username != 'root':
+ grant_all_cluster_roles(username, cluster_name)
except:
log.exception("grant all cluster roles")
flash(_('Creating the cluster "%s"...') % cluster_name,
'info')
Show replies by date