[jhbuild] [bot] update to buildbot slave xml description, and its parsing



commit e8500ff27549b57a345eb0e567bb52b392a181d6
Author: Frederic Peters <fpeters 0d be>
Date:   Tue May 5 20:44:18 2009 +0200

    [bot] update to buildbot slave xml description, and its parsing
    
    Elements of the buildbot slave description are now categorized,
    max_builds and missing_timeout are under <config> while the
    informational attributes move under <info>.
---
 jhbuild/commands/bot.py |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/jhbuild/commands/bot.py b/jhbuild/commands/bot.py
index b3f82d2..df90b9a 100644
--- a/jhbuild/commands/bot.py
+++ b/jhbuild/commands/bot.py
@@ -275,18 +275,23 @@ class cmd_bot(Command):
                 except: # parse error
                     return
 
-                for int_attribute in ('max_builds', 'missing_timeout'):
+                for attribute in ('config/max_builds', 'config/missing_timeout',
+                            'info/contact_name', 'info/contact_email',
+                            'info/url', 'info/distribution', 'info/architecture',
+                            'info/version'):
+                    attr_name = attribute.split('/')[-1]
                     try:
-                        setattr(self, int_attribute, int(cfg.find(int_attribute).text))
-                    except (AttributeError, ValueError):
-                        pass
+                        value = cfg.find(attribute).text
+                    except AttributeError:
+                        continue
+
+                    if attr_name in ('max_builds', 'missing_timeout'): # int value
+                        try:
+                            value = int(value)
+                        except ValueError:
+                            continue
 
-                for text_attribute in ('contact_name', 'contact_email', 'url',
-                        'distribution', 'architecture', 'version'):
-                    try:
-                        setattr(self, text_attribute, cfg.find(text_attribute).text)
-                    except (AttributeError, ValueError):
-                        pass
+                    setattr(self, attr_name, value)
 
         class JhBuildMaster(BuildMaster):
             jhbuild_config = config



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]