- send email
[plcapi.git] / PLC / Methods / AdmGenerateNodeConfFile.py
index c18dacc..8781e55 100644 (file)
@@ -37,10 +37,11 @@ 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]
+       PLCCheckLocalNode(node,"AdmGenerateNodeConfFile")
 
         # If we are not an admin, make sure that the caller is a
         # member of the site at which the node is located.
@@ -50,7 +51,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
@@ -69,6 +70,8 @@ class AdmGenerateNodeConfFile(Method):
         bytes = random.sample(xrange(0, 256), 32)
         # Base64 encode their string representation
         node['key'] = base64.b64encode("".join(map(chr, bytes)))
+        # XXX Boot Manager cannot handle = in the key
+        node['key'] = node['key'].replace("=", "")
         # Save it
         node.sync()