cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/site/luci/Extensions cluster_adapte ...
Date: 31 Oct 2006 17:18:14 -0000	[thread overview]
Message-ID: <20061031171814.6436.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-10-31 17:18:14

Modified files:
	luci/site/luci/Extensions: cluster_adapters.py 
	                           ricci_communicator.py 

Log message:
	fix node flags brokenness

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.134&r2=1.135
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&r1=1.15&r2=1.16

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/31 00:16:14	1.134
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/31 17:18:12	1.135
@@ -2898,31 +2898,35 @@
       try:
         cluname = req.form['clusterName']
       except:
-        luci_log.debug_verbose('No cluster name -- returning empty map')
+        luci_log.debug_verbose('ICB0: No cluster name -- returning empty map')
         return map
 
-  path = CLUSTER_FOLDER_PATH + cluname
+  path = str(CLUSTER_FOLDER_PATH + cluname)
   try:
-    clusterfolder = self.restrictedTraverse(str(path))
+    clusterfolder = self.restrictedTraverse(path)
     if not clusterfolder:
       raise Exception, 'clusterfolder is None'
   except Exception, e:
-    luci_log.debug_verbose('cluster %s [%s] folder missing: %s -- returning empty map' % (cluname, path, str(e)))
+    luci_log.debug_verbose('ICB1: cluster %s [%s] folder missing: %s -- returning empty map' % (cluname, path, str(e)))
     return map
   except:
-    luci_log.debug_verbose('cluster %s [%s] folder missing: returning empty map' % (cluname, path))
+    luci_log.debug_verbose('ICB2: cluster %s [%s] folder missing: returning empty map' % (cluname, path))
 
   try:
     items = clusterfolder.objectItems('ManagedSystem')
     if not items or len(items) < 1:
+      luci_log.debug_verbose('ICB3: no flags at %s for cluster %s' \
+          % (cluname, path))
       return map  #This returns an empty map, and should indicate not busy
   except Exception, e:
-    luci_log.debug('An error occurred while looking for cluster %s flags at path %s: %s' % (cluname, path, str(e)))
+    luci_log.debug('ICB4: An error occurred while looking for cluster %s flags at path %s: %s' % (cluname, path, str(e)))
     return map
   except:
-    luci_log.debug('An error occurred while looking for cluster %s flags at path %s' % (cluname, path))
+    luci_log.debug('ICB5: An error occurred while looking for cluster %s flags@path %s' % (cluname, path))
     return map
-    
+
+  luci_log.debug_verbose('ICB6: isClusterBusy: %s is busy: %d flags' \
+      % (cluname, len(items)))
   map['busy'] = "true"
   #Ok, here is what is going on...if there is an item,
   #we need to call the ricci_bridge and get a batch report.
@@ -2952,31 +2956,58 @@
       batch_xml = None
       ricci = item[0].split("____") #This removes the 'flag' suffix
 
+      luci_log.debug_verbose('ICB6A: using host %s for rc for item %s' \
+          % (ricci[0], item[0]))
       try:
         rc = RicciCommunicator(ricci[0])
+        if not rc:
+          rc = None
+          raise RicciError, 'rc is None for %s' % ricci[0]
       except RicciError, e:
         rc = None
-        luci_log.debug_verbose('ricci returned error in iCB for %s: %s' \
+        luci_log.debug_verbose('ICB7: ricci returned error in iCB for %s: %s' \
           % (cluname, str(e)))
       except:
         rc = None
-        luci_log.info('ricci connection failed for cluster %s' % cluname)
+        luci_log.info('ICB8: ricci connection failed for cluster %s' % cluname)
 
+      batch_id = None
       if rc is not None:
         try:
-          batch_xml = rc.batch_report(item[1].getProperty(BATCH_ID))
-          if batch_xml != None:
-            (creation_status, total) = batch_status(batch_xml)
-          else:
-            luci_log.debug_verbose('batch report for cluster %s, item %s is None' % (cluname, item[0]))
-        except:
-          creation_status = RICCI_CONNECT_FAILURE  #No contact with ricci (-1000)
-          batch_xml = "bloody_failure" #set to avoid next if statement
-      else:
+          batch_id = item[1].getProperty(BATCH_ID)
+          luci_log.debug_verbose('ICB8A: got batch_id %s from %s' \
+              % (batch_id, item[0]))
+        except Exception, e:
+          try:
+            luci_log.debug_verbose('ICB8B: failed to get batch_id from %s: %s' \
+                % (item[0], str(e)))
+          except:
+            luci_log.debug_verbose('ICB8C: failed to get batch_id from %s' % item[0])
+
+        if batch_id is not None:
+          try:
+            batch_xml = rc.batch_report(batch_id)
+            if batch_xml is not None:
+              luci_log.debug_verbose('ICB8D: batch_xml for %s from batch_report is not None -- getting batch status' % batch_id)
+              (creation_status, total) = batch_status(batch_xml)
+              try:
+                luci_log.debug_verbose('ICB8E: batch status returned (%d,%d)' \
+                    % (creation_status, total))
+              except:
+                luci_log.debug_verbose('ICB8F: error logging batch status return')
+            else:
+              luci_log.debug_verbose('ICB9: batch_xml for cluster is None')
+          except Exception, e:
+            luci_log.debug_verbose('ICB9A: error getting batch_xml from rc.batch_report: %s' % str(e))
+            creation_status = RICCI_CONNECT_FAILURE  #No contact with ricci (-1000)
+            batch_xml = "bloody_failure" #set to avoid next if statement
+
+      if rc is None or batch_id is None:
+          luci_log.debug_verbose('ICB12: unable to connect to a ricci agent for cluster %s to get batch status')
           creation_status = RICCI_CONNECT_FAILURE  #No contact with ricci (-1000)
-          batch_xml = "bloody_failure" #set to avoid next if statement
+          batch_xml = "bloody_bloody_failure" #set to avoid next if statement
 
-      if batch_xml == None:  #The job is done and gone from queue
+      if batch_xml is None:  #The job is done and gone from queue
         if redirect_message == False: #We have not displayed this message yet
           node_report['desc'] = REDIRECT_MSG
           node_report['iserror'] = True 
@@ -2984,7 +3015,7 @@
           nodereports.append(node_report)
           redirect_message = True
 
-        luci_log.debug_verbose('batch job is done -- deleting %s' % item[0])
+        luci_log.debug_verbose('ICB13: batch job is done -- deleting %s' % item[0])
         clusterfolder.manage_delObjects(item[0])
         continue
 
@@ -3038,7 +3069,7 @@
           try:
               clusterfolder.manage_delObjects(item[0])
           except Exception, e:
-              luci_log.info('Unable to delete %s: %s' % (item[0], str(e)))
+              luci_log.info('ICB14: Unable to delete %s: %s' % (item[0], str(e)))
           continue
         else:
           map['busy'] = "true"
--- conga/luci/site/luci/Extensions/ricci_communicator.py	2006/10/31 13:16:30	1.15
+++ conga/luci/site/luci/Extensions/ricci_communicator.py	2006/10/31 17:18:12	1.16
@@ -221,7 +221,7 @@
         return doc
 
     def batch_report(self, batch_id):
-        luci_log.debug_verbose('[auth=%d] asking for batchid# %d for host %s' \
+        luci_log.debug_verbose('[auth=%d] asking for batchid# %s for host %s' \
             % (self.__authed, batch_id, self.__hostname))
 
         if not self.authed():
@@ -244,7 +244,7 @@
         if doc.firstChild.getAttribute('success') == '12':
             return None
         if doc.firstChild.getAttribute('success') != '0':
-            raise RicciError, 'Error while retrieving batch report for batch #%s from host %s' % (batch_id, self.__hostname)
+            raise RicciError, 'Error while retrieving batch report for batch #%d from host %s' % (batch_id, self.__hostname)
         batch_node = None
         for node in doc.firstChild.childNodes:
             if node.nodeType == xml.dom.Node.ELEMENT_NODE:
@@ -403,10 +403,10 @@
                     last = last + 1
                     last = last - 2 * last
     try:
-        luci_log.debug_verbose('Returning (%s, %s) for batch_status(\"%s\")' \
+        luci_log.debug_verbose('Returning (%d, %d) for batch_status(\"%s\")' \
             % (last, total, batch_xml.toxml()))
     except:
-        pass
+        luci_log.debug_verbose('Returning last, total')
 
     return (last, total)
 



             reply	other threads:[~2006-10-31 17:18 UTC|newest]

Thread overview: 185+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-31 17:18 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-07-17 16:36 [Cluster-devel] conga/luci/site/luci/Extensions cluster_adapte rmccabe
2008-04-18 20:37 rmccabe
2007-12-12 15:45 rmccabe
2007-08-23 19:00 rmccabe
2007-08-22 20:57 rmccabe
2007-05-03 19:51 rmccabe
2007-04-02 16:35 rmccabe
2007-04-02 15:56 rmccabe
2007-03-27  2:03 rmccabe
2007-03-16  3:19 rmccabe
2007-03-16  3:19 rmccabe
2007-03-16  3:19 rmccabe
2007-03-13  3:07 rmccabe
2007-03-13  3:06 rmccabe
2007-03-12  5:47 rmccabe
2007-03-12  5:46 rmccabe
2007-03-12  5:46 rmccabe
2007-03-06 22:48 rmccabe
2007-03-01 20:22 rmccabe
2007-03-01 20:22 rmccabe
2007-03-01 20:22 rmccabe
2007-02-13 19:50 rmccabe
2007-02-13 19:50 rmccabe
2007-02-12 20:25 rmccabe
2007-02-12 20:24 rmccabe
2007-02-07 22:00 rmccabe
2007-02-07 21:30 rmccabe
2007-02-05 19:56 rmccabe
2007-01-31 23:45 rmccabe
2007-01-31 19:28 rmccabe
2007-01-31 18:50 rmccabe
2007-01-30 21:41 jparsons
2007-01-30 21:21 jparsons
2007-01-30 21:05 jparsons
2007-01-29 23:30 rmccabe
2007-01-26 19:35 rmccabe
2007-01-18  2:48 rmccabe
2007-01-17 22:26 rmccabe
2007-01-17 22:14 rmccabe
2007-01-10 23:33 jparsons
2007-01-10 22:45 rmccabe
2007-01-10 20:06 rmccabe
2006-12-20 20:40 jparsons
2006-12-14 21:37 rmccabe
2006-12-14 17:03 rmccabe
2006-12-08 23:02 rmccabe
2006-11-30 20:12 jparsons
2006-11-27 21:06 rmccabe
2006-11-27 21:05 rmccabe
2006-11-27 18:15 rmccabe
2006-11-20 23:32 rmccabe
2006-11-20 15:05 jparsons
2006-11-17  5:50 rmccabe
2006-11-17  5:48 rmccabe
2006-11-10 18:18 rmccabe
2006-11-10 17:59 rmccabe
2006-11-09 22:30 rmccabe
2006-11-09 14:17 rmccabe
2006-11-08 21:42 rmccabe
2006-11-08 15:52 jparsons
2006-11-07 20:14 jparsons
2006-11-07 20:13 jparsons
2006-11-07  2:36 jparsons
2006-11-07  1:32 jparsons
2006-11-06 23:55 rmccabe
2006-11-05  0:59 rmccabe
2006-11-03 21:13 jparsons
2006-11-03  1:24 rmccabe
2006-11-03  1:08 rmccabe
2006-11-02 20:58 rmccabe
2006-11-02 20:45 rmccabe
2006-11-02 20:41 rmccabe
2006-11-02  3:17 rmccabe
2006-10-31  0:16 rmccabe
2006-10-30 22:52 rmccabe
2006-10-30 20:43 jparsons
2006-10-27  1:11 rmccabe
2006-10-25  0:43 rmccabe
2006-10-24 14:08 rmccabe
2006-10-23 20:47 jparsons
2006-10-20 22:09 rmccabe
2006-10-20 21:59 rmccabe
2006-10-19 14:57 rmccabe
2006-10-18 23:12 rmccabe
2006-10-18 19:16 rmccabe
2006-10-16 21:01 rmccabe
2006-10-16 20:51 jparsons
2006-10-16 19:17 jparsons
2006-10-16  5:28 rmccabe
2006-10-16  4:54 rmccabe
2006-10-16  4:51 rmccabe
2006-10-13 22:56 rmccabe
2006-10-12 22:11 jparsons
2006-10-12 21:00 kupcevic
2006-10-12 20:54 jparsons
2006-10-12 20:48 jparsons
2006-10-12 19:40 rmccabe
2006-10-12 17:27 jparsons
2006-10-12 17:08 jparsons
2006-10-12 15:50 jparsons
2006-10-12 15:45 jparsons
2006-10-12  0:04 jparsons
2006-10-11 23:56 jparsons
2006-10-11 23:11 jparsons
2006-10-11 23:08 rmccabe
2006-10-11 22:37 jparsons
2006-10-11 20:58 jparsons
2006-10-11 17:43 jparsons
2006-10-11 17:29 rmccabe
2006-10-11 16:35 jparsons
2006-10-11 16:25 jparsons
2006-10-11 16:18 rmccabe
2006-10-10 21:33 kupcevic
2006-10-09 20:21 rmccabe
2006-10-04 16:20 rmccabe
2006-10-04 16:05 jparsons
2006-10-04 15:11 jparsons
2006-10-02 22:30 rmccabe
2006-10-02 21:42 rmccabe
2006-10-02 21:09 rmccabe
2006-10-02 20:53 rmccabe
2006-09-28 22:04 rmccabe
2006-09-28 20:10 rmccabe
2006-09-27 18:46 rmccabe
2006-09-27 16:18 jparsons
2006-09-27 15:51 jparsons
2006-09-27 15:35 jparsons
2006-09-25 22:59 rmccabe
2006-09-22 18:24 rmccabe
2006-08-30 22:59 rmccabe
2006-08-22 17:46 jparsons
2006-08-22 17:41 jparsons
2006-08-16 23:40 jparsons
2006-08-16 21:56 jparsons
2006-08-16 21:54 jparsons
2006-08-16 21:51 jparsons
2006-08-16 19:14 rmccabe
2006-08-16 16:10 jparsons
2006-08-14 15:12 jparsons
2006-08-13 19:38 jparsons
2006-08-13 19:37 jparsons
2006-08-13 18:36 jparsons
2006-08-13 16:32 jparsons
2006-08-13 16:15 jparsons
2006-08-13 15:02 jparsons
2006-08-13 14:57 jparsons
2006-08-13 13:48 jparsons
2006-08-12 21:13 jparsons
2006-08-12 20:31 jparsons
2006-08-12 18:22 jparsons
2006-08-12 17:53 jparsons
2006-08-11  0:29 jparsons
2006-08-10 23:06 shuennek
2006-08-10 16:50 jparsons
2006-08-10 14:16 jparsons
2006-08-09 22:05 jparsons
2006-08-09 21:48 jparsons
2006-08-03 13:37 jparsons
2006-08-02 18:59 rmccabe
2006-08-02 17:25 rmccabe
2006-08-01 15:29 jparsons
2006-08-01 15:25 jparsons
2006-08-01 15:20 jparsons
2006-08-01 15:13 jparsons
2006-08-01 15:04 jparsons
2006-07-31 18:21 rmccabe
2006-07-28 19:03 jparsons
2006-07-28 18:57 jparsons
2006-07-28 18:40 jparsons
2006-07-28 14:16 jparsons
2006-07-28 14:02 jparsons
2006-07-28 11:46 jparsons
2006-07-27 16:34 jparsons
2006-07-27 15:53 rmccabe
2006-07-25 20:16 jparsons
2006-07-25 20:01 jparsons
2006-07-25  0:56 jparsons
2006-07-24 21:51 jparsons
2006-07-24 21:13 jparsons
2006-07-24 19:50 jparsons
2006-07-19 22:28 rmccabe
2006-07-19 21:38 rmccabe
2006-07-19 20:57 rmccabe
2006-07-19 20:19 rmccabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061031171814.6436.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).