From: Tony Mack Date: Tue, 21 Aug 2007 13:26:35 +0000 (+0000) Subject: merge changes from HEAD X-Git-Tag: planetlab-4_1-rc2~6 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=dd451a33a9eeb9a7b2ccf490e916dd1f4196a24a;p=plcapi.git merge changes from HEAD --- diff --git a/PLC/Method.py b/PLC/Method.py index 552b7030..c700eed3 100644 --- a/PLC/Method.py +++ b/PLC/Method.py @@ -4,7 +4,7 @@ # Mark Huang # 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 diff --git a/PLC/Methods/AddSliceToNodes.py b/PLC/Methods/AddSliceToNodes.py index 3cfd327f..ce8bb1c6 100644 --- a/PLC/Methods/AddSliceToNodes.py +++ b/PLC/Methods/AddSliceToNodes.py @@ -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 \ diff --git a/PLC/Methods/BootUpdateNode.py b/PLC/Methods/BootUpdateNode.py index 271da9f2..52381cbe 100644 --- a/PLC/Methods/BootUpdateNode.py +++ b/PLC/Methods/BootUpdateNode.py @@ -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']} diff --git a/PLC/Methods/GetSlivers.py b/PLC/Methods/GetSlivers.py index 890b65f0..908bae12 100644 --- a/PLC/Methods/GetSlivers.py +++ b/PLC/Methods/GetSlivers.py @@ -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() diff --git a/PLCAPI.spec b/PLCAPI.spec index f5d39eec..af413e59 100644 --- a/PLCAPI.spec +++ b/PLCAPI.spec @@ -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 -