ops! this will cause problems for omf back-end. (fixed manually on PLE).
[plcapi.git] / PLC / Methods / GetNodeFlavour.py
index 8c3489f..c58830a 100644 (file)
@@ -28,40 +28,34 @@ class GetNodeFlavour(Method):
               Node.fields['hostname']),
         ]
 
-    returns = { 'nodefamily' : Parameter (str, "the node-family this node should be based upon"),
-                'extensions' : [ Parameter (str, "extension to add to the base install") ],
-                'uncompressed' : Parameter (bool, "for tests : use uncompressed bootstrapfs" ) ,
-                }
+    returns = { 
+        'nodefamily' : Parameter (str, "the nodefamily this node should be based upon"),
+        'extensions' : [ Parameter (str, "extensions to add to the base install") ],
+        'plain' : Parameter (bool, "use plain bootstrapfs image if set (for tests)" ) ,
+        }
 
     
     ########## nodefamily
-    def nodefamily (self, auth, node_id):
+    def nodefamily (self, auth, node_id, fcdistro, arch):
 
         # the deployment tag, if set, wins
         deployment = GetNodeDeployment (self.api).call(auth,node_id)
         if deployment: return deployment
 
-        arch = GetNodeArch (self.api).call(auth,node_id)
-        if not arch: arch = self.api.config.PLC_FLAVOUR_NODE_ARCH
-
         pldistro = GetNodePldistro (self.api).call(auth, node_id)
         if not pldistro: pldistro = self.api.config.PLC_FLAVOUR_NODE_PLDISTRO
 
-        ###fcdistro = GetNodeFcdistro (self.api).call(auth, node_id)
-        ###if not fcdistro: fcdistro = self.api.config.PLC_FLAVOUR_NODE_FCDISTRO
-
         # xxx would make sense to check the corresponding bootstrapfs is available
-        ###return "%s-%s-%s"%(pldistro,fcdistro,arch)
-        return "%s-%s"%(pldistro,arch)
+        return "%s-%s-%s"%(pldistro,fcdistro,arch)
 
-    def extensions (self, auth, node_id):
+    def extensions (self, auth, node_id, fcdistro, arch):
         try:
-            return GetNodeExtensions(self.api).call(auth,node_id).split()
+            return [ "%s-%s-%s"%(e,fcdistro,arch) for e in GetNodeExtensions(self.api).call(auth,node_id).split() ]
         except:
             return []
 
-    def compressed (self, auth, node_id):
-        return not not not GetNodePlainBootstrapfs(self.api).call(auth,node_id)
+    def plain (self, auth, node_id):
+        return not not GetNodePlainBootstrapfs(self.api).call(auth,node_id)
 
     def call(self, auth, node_id_or_name):
         # Get node information
@@ -71,8 +65,15 @@ class GetNodeFlavour(Method):
         node = nodes[0]
         node_id = node['node_id']
 
+        arch = GetNodeArch (self.api).call(auth,node_id)
+        if not arch: arch = self.api.config.PLC_FLAVOUR_NODE_ARCH
+
+        fcdistro = GetNodeFcdistro (self.api).call(auth, node_id)
+        if not fcdistro: fcdistro = self.api.config.PLC_FLAVOUR_NODE_FCDISTRO
+
         # xxx could use some sanity checking, and could provide fallbacks
-        return { 'nodefamily' : self.nodefamily(auth,node_id),
-                 'extensions' : self.extensions(auth,node_id),
-                 'compressed' : self.compressed(auth,node_id),
+        return { 'nodefamily' : self.nodefamily(auth,node_id, fcdistro, arch),
+                 'fcdistro' : fcdistro,
+                 'extensions' : self.extensions(auth,node_id, fcdistro, arch),
+                 'plain' : self.plain(auth,node_id),
                  }