- %v : the bootcd version string (e.g. 4.0)
- %p : the PLC name
- %f : the nodefamily
+ - %a : arch
With the file-based return mechanism, the method returns the full pathname
of the result file;
** WARNING **
except:
(pldistro,arch) = ("planetlab","i386")
+ if not node:
+ return (pldistro,arch)
+
known_archs = [ 'i386', 'x86_64' ]
nodegroupnames = [ ng['name'] for ng in NodeGroups (self.api, node['nodegroup_ids'],['name'])]
# (1) if groupname == arch, nodefamily becomes pldistro-groupname
raise PLCInvalidArgument, "No such node %r"%node_id_or_hostname
node = nodes[0]
nodename = node['hostname']
- # get nodefamily
- (pldistro,arch) = self.get_nodefamily(node)
- self.nodefamily="%s-%s"%(pldistro,arch)
- # apply on globals
- for attr in [ "BOOTCDDIR", "BOOTCDBUILD", "GENERICDIR" ]:
- setattr(self,attr,getattr(self,attr).replace("@NODEFAMILY@",self.nodefamily))
else:
node = None
tempbytes = random.sample (xrange(0,256), 8);
def hexa2 (c): return chr((c>>4)+65) + chr ((c&16)+65)
nodename = "".join(map(hexa2,tempbytes))
+
+ # get nodefamily
+ (pldistro,arch) = self.get_nodefamily(node)
+ self.nodefamily="%s-%s"%(pldistro,arch)
+ # apply on globals
+ for attr in [ "BOOTCDDIR", "BOOTCDBUILD", "GENERICDIR" ]:
+ setattr(self,attr,getattr(self,attr).replace("@NODEFAMILY@",self.nodefamily))
### handle filename
# allow to set filename to None or any other empty value
filename = filename.replace ("%s",suffix)
filename = filename.replace ("%p",self.api.config.PLC_NAME)
# let's be cautious
- try:
- filename = filename.replace ("%f", self.nodefamily)
- except:
- pass
- try:
- filename = filename.replace ("%v",self.bootcd_version())
- except:
- pass
+ try: filename = filename.replace ("%f", self.nodefamily)
+ except: pass
+ try: filename = filename.replace ("%a", arch)
+ except: pass
+ try: filename = filename.replace ("%v",self.bootcd_version())
+ except: pass
### Check filename location
if filename != '':