Merge from trunk
[plcapi.git] / trunk / PLC / Methods / AdmAddNode.py
diff --git a/trunk/PLC/Methods/AdmAddNode.py b/trunk/PLC/Methods/AdmAddNode.py
new file mode 100644 (file)
index 0000000..dda5c99
--- /dev/null
@@ -0,0 +1,33 @@
+from PLC.Faults import *
+from PLC.Method import Method
+from PLC.Parameter import Parameter, Mixed
+from PLC.Nodes import Node, Nodes
+from PLC.Sites import Site, Sites
+from PLC.Auth import Auth
+from PLC.Methods.AddNode import AddNode
+
+can_update = lambda (field, value): field in \
+             ['model', 'version']
+
+class AdmAddNode(AddNode):
+    """
+    Deprecated. See AddNode.
+    """
+
+    status = "deprecated"
+
+    node_fields = dict(filter(can_update, Node.fields.items()))
+
+    accepts = [
+        Auth(),
+        Site.fields['site_id'],
+        Node.fields['hostname'],
+        Node.fields['boot_state'],
+        node_fields
+        ]
+
+    def call(self, auth, site_id, hostname, boot_state, node_fields = {}):
+        node_fields['site_id'] = site_id
+        node_fields['hostname'] = hostname
+        node_fields['boot_state'] = boot_state
+        return AddNode.call(self, auth, node_fields)