git://git.onelab.eu
/
plcapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
70ae1fb
)
miscell
author
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Wed, 15 Feb 2017 22:19:48 +0000
(23:19 +0100)
committer
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Wed, 15 Feb 2017 22:19:48 +0000
(23:19 +0100)
Makefile
patch
|
blob
|
history
PLC/Debug.py
patch
|
blob
|
history
PLC/Methods/GetPeers.py
patch
|
blob
|
history
PLC/Methods/GetPersons.py
patch
|
blob
|
history
PLC/Methods/GetSites.py
patch
|
blob
|
history
PLC/Persons.py
patch
|
blob
|
history
php/plc_api.php
patch
|
blob
|
history
diff --git
a/Makefile
b/Makefile
index
97061a5
..
02dd3e4
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-76,7
+76,7
@@
ifeq (,$(SSHURL))
@echo " make sync PLCHOSTLXC=.. GUESTNAME=.."
@exit 1
else
@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
+$(RSYNC) db-config.d/ $(SSHURL)/etc/planetlab/db-config.d/
+$(RSYNC) plc.d/ $(SSHURL)/etc/plc.d/
$(SSHCOMMAND) /etc/plc.d/httpd stop
diff --git
a/PLC/Debug.py
b/PLC/Debug.py
index
27f9885
..
3a9993f
100644
(file)
--- a/
PLC/Debug.py
+++ b/
PLC/Debug.py
@@
-39,9
+39,10
@@
def profile(callable):
start = time.time()
result = callable(*args, **kwds)
end = time.time()
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
return result
return wrapper
diff --git
a/PLC/Methods/GetPeers.py
b/PLC/Methods/GetPeers.py
index
dca352a
..
4a77ce4
100644
(file)
--- a/
PLC/Methods/GetPeers.py
+++ b/
PLC/Methods/GetPeers.py
@@
-14,13
+14,13
@@
from PLC.Peers import Peer, Peers
class GetPeers (Method):
"""
Returns an array of structs containing details about peers. If
class GetPeers (Method):
"""
Returns an array of structs containing details about peers. If
- pe
rson
_filter is specified and is an array of peer identifiers or
+ pe
er
_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.
"""
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(),
accepts = [
Auth(),
diff --git
a/PLC/Methods/GetPersons.py
b/PLC/Methods/GetPersons.py
index
06da9f5
..
53143e0
100644
(file)
--- a/
PLC/Methods/GetPersons.py
+++ b/
PLC/Methods/GetPersons.py
@@
-50,7
+50,7
@@
class GetPersons(Method):
for site in sites:
valid_person_ids += site['person_ids']
if not valid_person_ids:
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
# this may look suspicious; what if person_filter is not None ?
# turns out the results are getting filtered again below, so we're safe
@@
-70,7
+70,7
@@
class GetPersons(Method):
# Must query at least person_id, site_ids, and role_ids (see
# Person.can_view() and below).
if return_fields is not None:
# 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 = []
return_fields += added_fields
else:
added_fields = []
diff --git
a/PLC/Methods/GetSites.py
b/PLC/Methods/GetSites.py
index
d277c28
..
78eb754
100644
(file)
--- a/
PLC/Methods/GetSites.py
+++ b/
PLC/Methods/GetSites.py
@@
-19,13
+19,13
@@
class GetSites(Method):
Auth(),
Mixed([Mixed(Site.fields['site_id'],
Site.fields['login_base'])],
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]
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)
return Sites(self.api, site_filter, return_fields)
diff --git
a/PLC/Persons.py
b/PLC/Persons.py
index
8276c06
..
d1b3c79
100644
(file)
--- a/
PLC/Persons.py
+++ b/
PLC/Persons.py
@@
-393,11
+393,11
@@
class Persons(Table):
person_filter = Filter(Person.fields, {'person_id': ints, 'email': strs})
sql += " AND (%s) %s" % person_filter.sql(api, "OR")
elif isinstance(person_filter, dict):
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(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})
sql += " AND (%s) %s" % person_filter.sql(api, "AND")
elif isinstance (person_filter, (int, long)):
person_filter = Filter(Person.fields, {'person_id':person_filter})
diff --git
a/php/plc_api.php
b/php/plc_api.php
index
3c878ba
..
b76b8b3
100644
(file)
--- a/
php/plc_api.php
+++ b/
php/plc_api.php
@@
-139,9
+139,6
@@
class PLCAPI
$url .= $this->server . ':' . $this->port . '/' . $this->path;
curl_setopt($curl, CURLOPT_URL, $url);
$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.
// 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.
@@
-244,10
+241,15
@@
class PLCAPI
}
}
}
}
+// 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",
global $adm;
$adm = new PLCAPI(array('AuthMethod' => "capability",
- 'Username' => PLC_API_MAINTENANCE_USER,
+ 'Username'
=> PLC_API_MAINTENANCE_USER,
'AuthString' => PLC_API_MAINTENANCE_PASSWORD));
?>
'AuthString' => PLC_API_MAINTENANCE_PASSWORD));
?>