From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 11 Oct 2006 17:29:48 -0000 Subject: [Cluster-devel] conga/luci/site/luci/Extensions cluster_adapte ... Message-ID: <20061011172948.16239.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Changes by: rmccabe at sourceware.org 2006-10-11 17:29:47 Modified files: luci/site/luci/Extensions: cluster_adapters.py homebase_adapters.py Log message: fix a couple of cluster deploy errors Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.91&r2=1.92 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.25&r2=1.26 --- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/10/11 16:35:19 1.91 +++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/10/11 17:29:46 1.92 @@ -159,19 +159,21 @@ try: cluster_os = nodeList[0]['os'] if not cluster_os: - raise - if len(filter(lambda x: x != cluster_os, nodeList[1:])) > 0: - raise + raise KeyError('OS for ' + nodeList[0]['host'] + ' is blank') except KeyError, e: - errors.append('Unable to identify the operating system running on the first cluster node.') - cluster_properties['isComplete'] = False - except: - errors.append('Cluster nodes must be running compatible operating systems.') cluster_properties['isComplete'] = False + errors.append('Unable to identify the operating system running on the first cluster node: ' + str(e)) if cluster_properties['isComplete'] != True: nodeUnauth(nodeList) return (False, {'errors': errors, 'requestResults':cluster_properties }) + else: + try: + if len(filter(lambda x: x['os'] != cluster_os, nodeList[1:])) > 0: + raise Exception('different operating systems were detected.') + except: + cluster_properties['isComplete'] = False + errors.append('Cluster nodes must be running compatible operating systems.') if cluster_properties['isComplete'] == True: batchNode = createClusterBatch(cluster_os, @@ -2223,7 +2225,7 @@ ricci = item[0].split("____") #This removes the 'flag' suffix rc = RicciCommunicator(ricci[0]) batch_xml = rc.batch_report(item[1].getProperty(BATCH_ID)) - (creation_status, total) = rc.batch_status(batch_xml) + (creation_status, total) = batch_status(batch_xml) if creation_status < 0: #an error was encountered if creation_status == -(INSTALL_TASK): node_report['iserror'] = True --- conga/luci/site/luci/Extensions/homebase_adapters.py 2006/10/11 16:18:58 1.25 +++ conga/luci/site/luci/Extensions/homebase_adapters.py 2006/10/11 17:29:46 1.26 @@ -148,6 +148,7 @@ def nodeAuth(cluster, host, passwd): systemName = host + os_str = 'rhel5' try: rc = RicciCommunicator(host) @@ -156,15 +157,14 @@ systemName = rc.system_name() except: error = 'Unable to establish a connection to the ricci agent on \"' + host + '\"' - return { 'host': host, 'ricci_host': systemName, 'errors': error, 'cur_auth': False, 'os': None } - + return { 'host': host, 'ricci_host': systemName, 'errors': error, 'cur_auth': False, 'os': os_str } if rc.authed(): prevAuth = True else: prevAuth = False if not passwd: - return { 'host': host, 'ricci_host': systemName, 'prev_auth': False, 'cur_auth': False, 'os': None} + return { 'host': host, 'ricci_host': systemName, 'prev_auth': False, 'cur_auth': False, 'os': os_str } else: try: rc.auth(passwd) @@ -190,7 +190,7 @@ return node error = 'Unable to authenticate to the ricci agent on \"' + host + '\"' - return { 'host': host, 'ricci_host': systemName, 'prev_auth': False , 'cur_auth': False, 'errors': error, 'os': None } + return { 'host': host, 'ricci_host': systemName, 'prev_auth': False , 'cur_auth': False, 'errors': error, 'os': os_str } def validateAddClusterInitial(self, request): errors = list() @@ -225,6 +225,10 @@ except: cluster_info = None + os_str = resolveOSType(rc.os()) + if os_str == None: + os_str = "rhel5" #Backup plan in case all is almost lost... + if not cluster_info or not cluster_info[0]: if not prevAuth: rc.unauth() @@ -239,7 +243,7 @@ if cluConf: nodeList = getClusterConfNodes(cluConf) - if not cluConf or not nodeList or len(nodeList) < 2: + if not cluConf or not nodeList or len(nodeList) < 1: if not prevAuth: rc.unauth() return (False, { 'errors': [ 'Error retrieving member nodes for cluster \"' + clusterName + '\"' ] }) @@ -248,7 +252,7 @@ if systemName[:9] == 'localhost': systemName = sysData[0] - node = { 'host': sysData[0], 'ricci_host': systemName, 'prev_auth': prevAuth, 'cur_auth': rc.authed() } + node = { 'host': sysData[0], 'ricci_host': systemName, 'prev_auth': prevAuth, 'cur_auth': rc.authed(), 'os': os_str } nodeHash[sysData[0]] = node rnodeHash[systemName] = node newNodeList.append(node)