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

extras-buildsys/utils package-builder.py,1.2,1.3



Author: dcbw

Update of /cvs/fedora/extras-buildsys/utils
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24698/utils

Modified Files:
	package-builder.py 
Log Message:
2005-06-15  Dan Williams <dcbw redhat com>

    * server/UserInterface.py
        - Add a list_clients call that returns a list of currentl active build clients

    * server/client_manager.py
        - Return list of active build clients

    * utils/package-builder.py
        - Hook up list_clients call, and refactor client printing code into new function
            use by both list_clients and update_clients




Index: package-builder.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/package-builder.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- package-builder.py	15 Jun 2005 04:10:08 -0000	1.2
+++ package-builder.py	15 Jun 2005 05:14:04 -0000	1.3
@@ -99,6 +99,19 @@
         print job
 
 
+def print_clients(banner, client_list):
+        print "\n%s:" % banner
+        print "-" * 70
+        for client in client_list:
+            string = "  " + client['address']
+            string = string + " " * (40 - len(client['address']))
+            for arch in client['arches']:
+                string = string + arch + " "
+            string = string + "    " + client['status']
+            print string
+        print ""
+
+
 def update_clients(server, email):
     """
     Tell the build server to requery its build client list and re-add dropped
@@ -108,18 +121,24 @@
     try:
         (e, msg, client_list) = server.update_clients()
         if len(client_list) > 0:
-            print "\nNew Build Clients:"
-            print "-" * 70
-            for client in client_list:
-                string = "  " + client['address']
-                string = string + " " * (40 - len(client['address']))
-                for arch in client['arches']:
-                    string = string + arch + " "
-                string = string + "    " + client['status']
-                print string
-            print ""
+            print_clients("New Build Clients", client_list)
+        else:
+            print "No new build clients found."
+    except (M2Crypto.SSL.SSLError, socket.error), e:
+        print "Error connecting to build server: '%s'" % e
+
+
+def list_clients(server, email):
+    """
+    Get a list of currently active build clients.
+    """
+
+    try:
+        (e, msg, client_list) = server.list_clients()
+        if len(client_list) > 0:
+            print_clients("Active Build Clients", client_list)
         else:
-            print "No new clients found."
+            print "No active build clients found."
     except (M2Crypto.SSL.SSLError, socket.error), e:
         print "Error connecting to build server: '%s'" % e
 
@@ -187,6 +206,7 @@
         print "      enqueue_srpm <package> <cvs_tag> <target>"
         print "      list_own_jobs"
         print "      update_clients"
+        print "      list_clients"
         sys.exit(1)
 
     # Write out config file if it doesn't exist
@@ -218,4 +238,6 @@
         list_own_jobs(server, email)
     elif cmd == 'update_clients':
         update_clients(server, email)
+    elif cmd == 'list_clients':
+        list_clients(server, email)
 


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