From bc818798997c86e0a26de1a9e70023af9a09cfac Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Mon, 25 Jan 2010 16:35:41 +0000 Subject: [PATCH] tweaked - should be in sync with bm-5.0 --- PLC/Methods/GetNodeFlavour.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/PLC/Methods/GetNodeFlavour.py b/PLC/Methods/GetNodeFlavour.py index 8c3489f2..79943f9b 100644 --- a/PLC/Methods/GetNodeFlavour.py +++ b/PLC/Methods/GetNodeFlavour.py @@ -28,22 +28,20 @@ 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 node-family 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, 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 @@ -54,14 +52,14 @@ class GetNodeFlavour(Method): ###return "%s-%s-%s"%(pldistro,fcdistro,arch) return "%s-%s"%(pldistro,arch) - def extensions (self, auth, node_id): + def extensions (self, auth, node_id, arch): try: - return GetNodeExtensions(self.api).call(auth,node_id).split() + return [ "%s-%s"%(e,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 +69,11 @@ 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 + # 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, arch), + 'extensions' : self.extensions(auth,node_id, arch), + 'plain' : self.plain(auth,node_id), } -- 2.47.0