# $ run export
# and cut'n paste the export lines before you run make sync
-PLCHOST ?= testplc.onelab.eu
-
ifdef PLC
SSHURL:=root@$(PLC):/
SSHCOMMAND:=ssh root@$(PLC)
else
ifdef PLCHOSTLXC
-SSHURL:=root@$(PLCHOST):/var/lib/lxc/$(GUESTNAME)/rootfs
+SSHURL:=root@$(PLCHOSTLXC):/var/lib/lxc/$(GUESTNAME)/rootfs
SSHCOMMAND:=ssh root@$(PLCHOSTLXC) ssh $(GUESTHOSTNAME)
else
ifdef PLCHOSTVS
]
returns = Parameter(int, 'New interface_id (> 0) if successful')
-
+
+ # needed for generating the doc and prevent conflicts in the xml ids
+ status = 'legacy'
def call(self, auth, node_id_or_hostname, interface_fields):
returns = Parameter(int, 'New node_id (> 0) if successful')
+ # needed for generating the doc and prevent conflicts in the xml ids
+ status = 'legacy'
+
def call(self, auth, site_id_or_login_base, node_fields):
[native,tags,rejected]=Row.split_fields(node_fields,[legacy_node_fields,Node.tags])
returns = Parameter(int, '1 if successful')
+ # needed for generating the doc and prevent conflicts in the xml ids
+ status = 'legacy'
def call(self, auth, interface_id):
returns = Parameter(int, '1 if successful')
+ # needed for generating the doc and prevent conflicts in the xml ids
+ status = 'legacy'
+
def call(self, auth, node_id_or_hostname):
# Get account information
nodes = Nodes(self.api, [node_id_or_hostname])
returns = [Interface.fields] + ["type", "ip", "netmask", "network", "broadcast"]
+ # needed for generating the doc and prevent conflicts in the xml ids
+ status = 'legacy'
+
def call(self, auth, interface_filter = None, return_fields = None):
if (return_fields is not None):
interface_return_fields = return_fields[:]
returns = [legacy_node_fields]
+ # needed for generating the doc and prevent conflicts in the xml ids
+ status = 'legacy'
def call(self, auth, node_filter = None, return_fields = None):
returns = Parameter(int, '1 if successful')
+ # needed for generating the doc and prevent conflicts in the xml ids
+ status = 'legacy'
+
def call(self, auth, interface_id, interface_fields):
[native,tags,rejected] = Row.split_fields(interface_fields,[legacy_interface_fields,Interface.tags])
returns = Parameter(int, '1 if successful')
+ # needed for generating the doc and prevent conflicts in the xml ids
+ status = 'legacy'
+
def call(self, auth, node_id_or_hostname, node_fields):
# split provided fields
self.connection.close()
self.connection = None
+ @staticmethod
+ # From pgdb, and simplify code
+ def _quote(x):
+ if isinstance(x, DateTimeType):
+ x = str(x)
+ elif isinstance(x, unicode):
+ x = x.encode( 'utf-8' )
+
+ if isinstance(x, types.StringType):
+ x = "'%s'" % str(x).replace("\\", "\\\\").replace("'", "''")
+ elif isinstance(x, (types.IntType, types.LongType, types.FloatType)):
+ pass
+ elif x is None:
+ x = 'NULL'
+ elif isinstance(x, (types.ListType, types.TupleType, set)):
+ x = 'ARRAY[%s]' % ', '.join(map(lambda x: str(_quote(x)), x))
+ elif hasattr(x, '__pg_repr__'):
+ x = x.__pg_repr__()
+ else:
+ raise PLCDBError, 'Cannot quote type %s' % type(x)
+ return x
+
+
def quote(self, value):
"""
Returns quoted version of the specified value.
"""
- # The pgdb._quote function is good enough for general SQL
- # quoting, except for array types.
- if isinstance (value, (types.ListType, types.TupleType, set)):
- 'ARRAY[%s]' % ', '.join( [ str(self.quote(x)) for x in value ] )
- else:
- try:
- # up to PyGreSQL-3.x, function was pgdb._quote
- import pgdb
- return pgdb._quote(value)
- except:
- # with PyGreSQL-4.x, use psycopg2's adapt
- from psycopg2.extensions import adapt
- return adapt (value)
+ return PostgreSQL._quote (value)
+
+# following is an unsuccessful attempt to re-use lib code as much as possible
+# def quote(self, value):
+# # The pgdb._quote function is good enough for general SQL
+# # quoting, except for array types.
+# if isinstance (value, (types.ListType, types.TupleType, set)):
+# 'ARRAY[%s]' % ', '.join( [ str(self.quote(x)) for x in value ] )
+# else:
+# try:
+# # up to PyGreSQL-3.x, function was pgdb._quote
+# import pgdb
+# return pgdb._quote(value)
+# except:
+# # with PyGreSQL-4.x, use psycopg2's adapt
+# from psycopg2.extensions import adapt
+# return adapt (value)
@classmethod
def param(self, name, value):
%define name PLCAPI
%define version 5.1
-%define taglevel 0
+%define taglevel 1
%define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
%changelog
+* Mon Apr 16 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - plcapi-5.1-1
+- fix gpg-authentication for Persons (thanks Jordan)
+- PostgreSQL.quote reviewed for f16/postgresql9 (used deprecated internal helper)
+- ip address/network check: v4 or v6
+- customized DB Message survive upgrade
+- make sync works in lxc-hosted tests
+- no svn keywords anymore
+
* Fri Feb 24 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - plcapi-5.0-37
- fix sorting for methods list in docs
- untested but needed tweak for postgres startup in f16
def Process (self):
for func in self.functions_list:
- method = func.name
if func.status == "deprecated":
continue
+ method = func.name
+ if func.status == 'legacy':
+ method += "-legacy"
+
(min_args, max_args, defaults) = func.args()
section = Element('section')
- section.setAttribute('id', func.name)
- section.appendChild(simpleElement('title', func.name))
+ section.setAttribute('id', method)
+ section.appendChild(simpleElement('title', method))
prototype = "%s (%s)" % (method, ", ".join(max_args))
para = paraElement('Prototype:')