# call getNodeFlavour and store in VARS['node_flavour']
try:
node_flavour = BootAPI.call_api_function(vars, "GetNodeFlavour", (vars['NODE_ID'], ) )
- nodefamily = node_flavour['nodefamily']
- extensions = node_flavour['extensions']
- plain = node_flavour['plain']
except:
- exc_type, exc_value, exc_traceback = sys.exc_info()
- lines=traceback.format_exception(exc_type,exc_value,exc_traceback)
- for line in lines: log.write(line)
- raise BootManagerException ("Could not call GetNodeFlavour - need PLCAPI-5.2")
+ log.write("GetNodeFlavour failed, not fatal if the node flavor is available in ``configuration''\n")
+ pass
- # 'vs' or 'lxc'
- vars['virt'] = node_flavour['virt']
- # the basename for downloading nodeimage
- vars['nodefamily'] = node_flavour['nodefamily']
- # extensions to be applied on top of the base nodeimage
- vars['extensions'] = node_flavour ['extensions']
- # false if compressed image, true if not
- vars['plain'] = node_flavour ['plain']
+ flavour_keys = [
+ 'virt',# 'vs' or 'lxc'
+ 'nodefamily',# the basename for downloading nodeimage
+ 'extensions',# extensions to be applied on top of the base nodeimage
+ 'plain'# false if compressed image, true if not
+ ]
+
+ # MyPLC 5.0 workaround
+ try:
+ if (vars['extensions']==''):
+ vars['extensions']=[]
+ except:
+ pass
+
+ for k in flavour_keys:
+ # Support MyPLC <5.2
+ if (not vars.has_key(k)):
+ try:
+ vars[k] = node_flavour[k]
+ except:
+ exc_type, exc_value, exc_traceback = sys.exc_info()
+ lines=traceback.format_exception(exc_type,exc_value,exc_traceback)
+ for line in lines: log.write(line)
+ raise BootManagerException ("Could not call GetNodeFlavour - need PLCAPI-5.2")
+
log.write ("NodeFlavour as returned from PLC: %s\n"%node_flavour)
return 1