From b88c7bb567e12596743ec1dc6470e1846f316ace Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 17 Apr 2012 16:33:26 +0200 Subject: [PATCH] fix PLCAPI doc that was whining about duplicate ids in docbook xml output --- PLC/Methods/Legacy/AddInterface.py | 4 +++- PLC/Methods/Legacy/AddNode.py | 3 +++ PLC/Methods/Legacy/DeleteInterface.py | 2 ++ PLC/Methods/Legacy/DeleteNode.py | 3 +++ PLC/Methods/Legacy/GetInterfaces.py | 3 +++ PLC/Methods/Legacy/GetNodes.py | 2 ++ PLC/Methods/Legacy/UpdateInterface.py | 3 +++ PLC/Methods/Legacy/UpdateNode.py | 3 +++ doc/DocBook.py | 9 ++++++--- 9 files changed, 28 insertions(+), 4 deletions(-) diff --git a/PLC/Methods/Legacy/AddInterface.py b/PLC/Methods/Legacy/AddInterface.py index 5d2774d0..d9a245be 100644 --- a/PLC/Methods/Legacy/AddInterface.py +++ b/PLC/Methods/Legacy/AddInterface.py @@ -66,7 +66,9 @@ class AddInterface(Method): ] 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): diff --git a/PLC/Methods/Legacy/AddNode.py b/PLC/Methods/Legacy/AddNode.py index 0fc7e5ad..1d032e62 100644 --- a/PLC/Methods/Legacy/AddNode.py +++ b/PLC/Methods/Legacy/AddNode.py @@ -78,6 +78,9 @@ class AddNode(Method): 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]) diff --git a/PLC/Methods/Legacy/DeleteInterface.py b/PLC/Methods/Legacy/DeleteInterface.py index 82d0f7eb..ff58b64a 100644 --- a/PLC/Methods/Legacy/DeleteInterface.py +++ b/PLC/Methods/Legacy/DeleteInterface.py @@ -27,6 +27,8 @@ class DeleteInterface(Method): 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): diff --git a/PLC/Methods/Legacy/DeleteNode.py b/PLC/Methods/Legacy/DeleteNode.py index 01e382a3..cd833f2e 100644 --- a/PLC/Methods/Legacy/DeleteNode.py +++ b/PLC/Methods/Legacy/DeleteNode.py @@ -26,6 +26,9 @@ class DeleteNode(Method): 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]) diff --git a/PLC/Methods/Legacy/GetInterfaces.py b/PLC/Methods/Legacy/GetInterfaces.py index d5938e97..67045f32 100644 --- a/PLC/Methods/Legacy/GetInterfaces.py +++ b/PLC/Methods/Legacy/GetInterfaces.py @@ -59,6 +59,9 @@ class GetInterfaces(Method): 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[:] diff --git a/PLC/Methods/Legacy/GetNodes.py b/PLC/Methods/Legacy/GetNodes.py index 84fddb99..b03e9744 100644 --- a/PLC/Methods/Legacy/GetNodes.py +++ b/PLC/Methods/Legacy/GetNodes.py @@ -82,6 +82,8 @@ class GetNodes(Method): 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): diff --git a/PLC/Methods/Legacy/UpdateInterface.py b/PLC/Methods/Legacy/UpdateInterface.py index d2119c96..6ca3fd2d 100644 --- a/PLC/Methods/Legacy/UpdateInterface.py +++ b/PLC/Methods/Legacy/UpdateInterface.py @@ -70,6 +70,9 @@ class UpdateInterface(Method): 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]) diff --git a/PLC/Methods/Legacy/UpdateNode.py b/PLC/Methods/Legacy/UpdateNode.py index a0e8ee42..4aac1afd 100644 --- a/PLC/Methods/Legacy/UpdateNode.py +++ b/PLC/Methods/Legacy/UpdateNode.py @@ -81,6 +81,9 @@ class UpdateNode(Method): 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 diff --git a/doc/DocBook.py b/doc/DocBook.py index 90b384d7..832f0526 100755 --- a/doc/DocBook.py +++ b/doc/DocBook.py @@ -108,16 +108,19 @@ class DocBook: 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:') -- 2.47.0