@echo " make sync PLCHOSTLXC=.. GUESTNAME=.."
@exit 1
else
- +$(RSYNC) plcsh PLC planetlab5.sql migrations aspects $(SSHURL)/usr/share/plc_api/
+ +$(RSYNC) plcsh PLC planetlab5.sql migrations aspects php $(SSHURL)/usr/share/plc_api/
+$(RSYNC) db-config.d/ $(SSHURL)/etc/planetlab/db-config.d/
+$(RSYNC) plc.d/ $(SSHURL)/etc/plc.d/
$(SSHCOMMAND) /etc/plc.d/httpd stop
start = time.time()
result = callable(*args, **kwds)
end = time.time()
- args = map(str, args)
- args += ["%s = %s" % (name, str(value)) for (name, value) in kwds.items()]
- print >> log, "%s (%s): %f s" % (callable.__name__, ", ".join(args), end - start)
+ params = map(str, args)
+ params += ["{} = {}".format(name, value) for (name, value) in kwds.items()]
+ params = ", ".join(params)
+ print >> log, "{} ({}) {:f}s -> {}".format(callable.__name__, params, end - start, result)
return result
return wrapper
class GetPeers (Method):
"""
Returns an array of structs containing details about peers. If
- person_filter is specified and is an array of peer identifiers or
+ peer_filter is specified and is an array of peer identifiers or
peer names, or a struct of peer attributes, only peers matching
the filter will be returned. If return_fields is specified, only the
specified details will be returned.
"""
- roles = ['admin', 'node','pi','user']
+ roles = ['admin', 'node', 'pi', 'user']
accepts = [
Auth(),
for site in sites:
valid_person_ids += site['person_ids']
if not valid_person_ids:
- return []
+ return[]
# this may look suspicious; what if person_filter is not None ?
# turns out the results are getting filtered again below, so we're safe
# Must query at least person_id, site_ids, and role_ids (see
# Person.can_view() and below).
if return_fields is not None:
- added_fields = set(['person_id', 'site_ids', 'role_ids','roles']).difference(return_fields)
+ added_fields = set(['person_id', 'site_ids', 'role_ids', 'roles']).difference(return_fields)
return_fields += added_fields
else:
added_fields = []
Auth(),
Mixed([Mixed(Site.fields['site_id'],
Site.fields['login_base'])],
- Parameter(str,"login_base"),
- Parameter(int,"site_id"),
+ Parameter(str, "login_base"),
+ Parameter(int, "site_id"),
Filter(Site.fields)),
Parameter([str], "List of fields to return", nullok = True)
]
returns = [Site.fields]
- def call(self, auth, site_filter = None, return_fields = None):
+ def call(self, auth, site_filter = None, return_fields=None):
return Sites(self.api, site_filter, return_fields)
person_filter = Filter(Person.fields, {'person_id': ints, 'email': strs})
sql += " AND (%s) %s" % person_filter.sql(api, "OR")
elif isinstance(person_filter, dict):
- allowed_fields=dict(Person.fields.items()+Person.tags.items())
+ allowed_fields = dict(Person.fields.items() + Person.tags.items())
person_filter = Filter(allowed_fields, person_filter)
sql += " AND (%s) %s" % person_filter.sql(api, "AND")
elif isinstance (person_filter, StringTypes):
- person_filter = Filter(Person.fields, {'email':person_filter})
+ person_filter = Filter(Person.fields, {'email' : person_filter})
sql += " AND (%s) %s" % person_filter.sql(api, "AND")
elif isinstance (person_filter, (int, long)):
person_filter = Filter(Person.fields, {'person_id':person_filter})
$url .= $this->server . ':' . $this->port . '/' . $this->path;
curl_setopt($curl, CURLOPT_URL, $url);
- // this tentatively allows to tune mainstream xmlrpc php lib
- // so as to achieve the same behaviour as with our patched lib
- $xmlrpc_null_extension = TRUE;
// Marshal the XML-RPC request as a POST variable. <nil/> is an
// extension to the XML-RPC spec that is supported in our custom
// version of xmlrpc.so via the 'allow_null' output_encoding key.
}
}
+// this tentatively allows to tune mainstream xmlrpc php lib
+// so as to achieve the same behaviour as with our patched lib
+$GLOBALS['xmlrpc_null_extension'] = true;
+$GLOBALS['$xmlrpc_null_apache_encodingn'] = true;
+
global $adm;
$adm = new PLCAPI(array('AuthMethod' => "capability",
- 'Username' => PLC_API_MAINTENANCE_USER,
+ 'Username' => PLC_API_MAINTENANCE_USER,
'AuthString' => PLC_API_MAINTENANCE_PASSWORD));
?>