merge changes from HEAD
authorTony Mack <tmack@cs.princeton.edu>
Tue, 21 Aug 2007 13:26:35 +0000 (13:26 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Tue, 21 Aug 2007 13:26:35 +0000 (13:26 +0000)
PLC/Method.py
PLC/Methods/AddSliceToNodes.py
PLC/Methods/BootUpdateNode.py
PLC/Methods/GetSlivers.py
PLCAPI.spec

index 552b703..c700eed 100644 (file)
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: Method.py,v 1.27 2007/05/16 18:56:03 tmack Exp $
+# $Id: Method.py,v 1.29 2007/08/20 20:31:47 tmack Exp $
 #
 
 import xmlrpclib
@@ -92,8 +92,8 @@ class Method:
            result = self.call(*args, **kwds)
            runtime = time.time() - start
 
-            if self.api.config.PLC_API_DEBUG or hasattr(self, 'message'):
-               self.log(0, runtime, *args)
+            if self.api.config.PLC_API_DEBUG: #or hasattr(self, 'message'):
+               self.log(None, runtime, *args)
                
            return result
 
@@ -108,10 +108,10 @@ class Method:
             # Prepend caller and method name to expected faults
             fault.faultString = caller + ": " +  self.name + ": " + fault.faultString
            runtime = time.time() - start
-           self.log(fault.faultCode, runtime, *args)
+           self.log(fault, runtime, *args)
             raise fault
 
-    def log(self, fault_code, runtime, *args):
+    def log(self, fault, runtime, *args):
         """
         Log the transaction 
         """    
@@ -122,7 +122,9 @@ class Method:
 
         # Create a new event
         event = Event(self.api)
-        event['fault_code'] = fault_code
+       event['fault_code'] = 0
+       if fault:
+            event['fault_code'] = fault.faultCode
         event['runtime'] = runtime
 
         # Redact passwords and sessions
@@ -159,7 +161,9 @@ class Method:
        
 
        # Set the message for this event
-       if hasattr(self, 'message'):
+       if fault:
+           event['message'] = fault.faultString
+       elif hasattr(self, 'message'):
             event['message'] = self.message    
        
         # Commit
index 3cfd327..ce8bb1c 100644 (file)
@@ -47,7 +47,7 @@ class AddSliceToNodes(Method):
                 raise PLCPermissionDenied, "Specified slice not associated with any of your sites"
        
         # Get specified nodes, add them to the slice         
-        nodes = Nodes(self.api, node_id_or_hostname_list)
+        nodes = Nodes(self.api, node_id_or_hostname_list, ['node_id', 'hostname', 'slice_ids', 'slice_ids_whitelist'])
        for node in nodes:
            # check the slice whitelist on each node first
            if node['slice_ids_whitelist'] and \
index 271da9f..52381cb 100644 (file)
@@ -1,7 +1,7 @@
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
-from PLC.Auth import Auth, BootAuth
+from PLC.Auth import Auth, BootAuth, SessionAuth
 from PLC.Nodes import Node, Nodes
 from PLC.NodeNetworks import NodeNetwork, NodeNetworks
 
@@ -22,7 +22,7 @@ class BootUpdateNode(Method):
     nodenetwork_fields = dict(filter(can_update, NodeNetwork.fields.items()))
 
     accepts = [
-        BootAuth(),
+        Mixed(BootAuth(), SessionAuth()),
         {'boot_state': Node.fields['boot_state'],
          'primary_network': nodenetwork_fields,
          'ssh_host_key': Node.fields['ssh_rsa_key']}
index 890b65f..908bae1 100644 (file)
@@ -17,7 +17,7 @@ from PLC.InitScripts import InitScript, InitScripts
 
 def get_slivers(api, slice_filter, node = None):
     # Get slice information
-    slices = Slices(api, slice_filter)
+    slices = Slices(api, slice_filter, ['slice_id', 'name', 'instantiation', 'expires', 'person_ids', 'slice_attribute_ids'])
 
     # Build up list of users and slice attributes
     person_ids = set()
index f5d39ee..af413e5 100644 (file)
@@ -1,6 +1,6 @@
 Summary: PlanetLab Central API
 Name: PLCAPI
-Version: 4.1
+Version: 4.2
 Release: 2%{?pldistro:.%{pldistro}}%{?date:.%{date}}
 License: PlanetLab
 Group: System Environment/Daemons
@@ -74,7 +74,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/plcsh
 %{php_extension_dir}/xmlrpc.so
 %{_sysconfdir}/php.d/xmlrpc.ini
-%{_bindir}/refresh-peer.py
+%{_bindir}/refresh-peer.py*
 
 %changelog
 * Fri Oct 27 2006 Mark Huang <mlhuang@CS.Princeton.EDU> -