Merge remote-tracking branch 'origin/pycurl' into planetlab-4_0-branch
[plcapi.git] / PLC / Methods / AdmGenerateNodeConfFile.py
index 2af6a6f..85789bd 100644 (file)
@@ -37,11 +37,14 @@ class AdmGenerateNodeConfFile(Method):
 
     def call(self, auth, node_id_or_hostname):
         # Get node information
-        nodes = Nodes(self.api, [node_id_or_hostname]).values()
+        nodes = Nodes(self.api, [node_id_or_hostname])
         if not nodes:
             raise PLCInvalidArgument, "No such node"
         node = nodes[0]
 
+        if node['peer_id'] is not None:
+            raise PLCInvalidArgument, "Not a local node"
+
         # If we are not an admin, make sure that the caller is a
         # member of the site at which the node is located.
         if 'admin' not in self.caller['roles']:
@@ -50,7 +53,7 @@ class AdmGenerateNodeConfFile(Method):
 
        # Get node networks for this node
         primary = None
-        nodenetworks = NodeNetworks(self.api, node['nodenetwork_ids']).values()
+        nodenetworks = NodeNetworks(self.api, node['nodenetwork_ids'])
         for nodenetwork in nodenetworks:
             if nodenetwork['is_primary']:
                 primary = nodenetwork