# 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
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
# 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
"""
# 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
# 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
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 \
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
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']}
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()
Summary: PlanetLab Central API
Name: PLCAPI
-Version: 4.1
+Version: 4.2
Release: 2%{?pldistro:.%{pldistro}}%{?date:.%{date}}
License: PlanetLab
Group: System Environment/Daemons
%{_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> -