define systemd.log_target=console when used with systemd-debug
[plcapi.git] / PLC / Methods / BootGetNodeDetails.py
index b616b5a..afc7b0c 100644 (file)
@@ -2,7 +2,7 @@ from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Auth import BootAuth
 from PLC.Nodes import Node, Nodes
-from PLC.NodeNetworks import NodeNetwork, NodeNetworks
+from PLC.Interfaces import Interface, Interfaces
 from PLC.Sessions import Session, Sessions
 
 class BootGetNodeDetails(Method):
@@ -19,7 +19,7 @@ class BootGetNodeDetails(Method):
         'hostname': Node.fields['hostname'],
         'boot_state': Node.fields['boot_state'],
         'model': Node.fields['model'],
-        'networks': [NodeNetwork.fields],
+        'networks': [Interface.fields],
         'session': Session.fields['session_id'],
         }
 
@@ -27,7 +27,8 @@ class BootGetNodeDetails(Method):
         details = {
             'hostname': self.caller['hostname'],
             'boot_state': self.caller['boot_state'],
-            'model': self.caller['model'],
+            # XXX Boot Manager cannot unmarshal None
+            'model': self.caller['model'] or "",
             }
 
         # Generate a new session value
@@ -37,8 +38,17 @@ class BootGetNodeDetails(Method):
 
         details['session'] = session['session_id']
 
-        if self.caller['nodenetwork_ids']:
-            details['networks'] = NodeNetworks(self.api, self.caller['nodenetwork_ids']).values()
-
+        if self.caller['interface_ids']:
+            details['networks'] = Interfaces(self.api, self.caller['interface_ids'])
+            # XXX Boot Manager cannot unmarshal None
+            for network in details['networks']:
+                for field in network:
+                    if network[field] is None:
+                        if isinstance(network[field], (int, long)):
+                            network[field] = -1
+                        else:
+                            network[field] = ""
+
+        self.message = "Node request boot_state (%s) and networks" % \
+                (details['boot_state'])
         return details
-