modified: interface/ri_data.py

modified:   interface/ri_oper.py
    return back 400911c41a
This commit is contained in:
fling
2010-10-15 12:42:28 +08:00
parent 4c41888cbf
commit 46d11f3a25
2 changed files with 286 additions and 285 deletions

View File

@@ -11,10 +11,10 @@ config_xml = '../xml/config.xml'
def to_xml_attr(doc, node, cls, name):
''' This method is called by to_xml. Its function is to create an attribute, and set its value based on Network data member
doc - xml document
node - xml node
cls - python class/python instance
name - attribute name'''
doc - xml document
node - xml node
cls - python class/python instance
name - attribute name'''
attr = doc.createAttribute(name)
attr.value = getattr(cls, name)
node.setAttributeNode(attr)
@@ -30,8 +30,8 @@ class SerialNumber:
@staticmethod
def to_xml(doc, p_node):
''' write SerialNumber into xml
doc - xml document instance
p_node - xml node (parent node)'''
doc - xml document instance
p_node - xml node (parent node)'''
sn = doc.createElement('serial-number')
data = doc.createTextNode(SerialNumber.value)
sn.appendChild(data)
@@ -67,49 +67,49 @@ class Partition:
print "Error cat : command not found or /proc/partitions dosen't exsit"
return
for s in o.splitlines():
ret = re.search(r".+([sh][a-zA-Z]+)\s*",s)
if ret:
if ret.group(1) in device_list:
continue
device_list.append(ret.group(1))
ret = re.search(r".+([sh][a-zA-Z]+)\s*",s)
if ret:
if ret.group(1) in device_list:
continue
device_list.append(ret.group(1))
for d in device_list:
st,o=commands.getstatusoutput('parted /dev/%s unit %s print'%(d,Partition.unit))
if st:
print "Error parted :command not found"
return
for s in o.splitlines():
ret = p.split(s)
if ret[0]=='Partition':
Partition.label=ret[-1]
if len(ret) > 1 and ret[1].isdigit():
# ret[0] is ['']
#Number start end size type file_system flags
# 1 2.0B 33GB 1GB primary raid
# 2 32GB 33GB 1GB primary raid, boot ...
# 3 32GB 33GB 1GB primary boot, raid, lbx ...
# 4 32GB 33GB 1GB primary exit2 raid
# 5 32GB 33GB 1GB primary exit2 raid, boot ...
# 6 3.2kB 33GB 1GB primary
# 7 32GB 33GB 1GB primary linx-swap
# 8 32GB 33GB 1GB primary boot, lbx ...
# 9 32GB 33GB 1GB primary exit2 boot
#ret[1] ret[2] ret[3] ret[4] ret[5] ret[6] ret[7]
ret+=['','','']
ret[2]=ret[2][:-len(Partition.unit)]
ret[3]=ret[3][:-len(Partition.unit)]
ret[4]=ret[4][:-len(Partition.unit)]
if "raid" in ret[6:] or "raid," in ret[6:]:
ret[7]='yes'
if ret[6][:3].lower()=='raid' or ret[6].lower() not in fs_list:
ret[6]=''
else:
ret[7]='no'
if ret[6].lower() not in fs_list:
ret[6]=''
Partition(d+ret[1],ret[2],ret[4],ret[5],ret[6][:10] == "linux-swap" and "swap" or ret[6] ,ret[7],'yes')
st,o=commands.getstatusoutput('parted /dev/%s unit %s print'%(d,Partition.unit))
if st:
print "Error parted :command not found"
return
for s in o.splitlines():
ret = p.split(s)
if ret[0]=='Partition':
Partition.label=ret[-1]
if len(ret) > 1 and ret[1].isdigit():
# ret[0] is ['']
#Number start end size type file_system flags
# 1 2.0B 33GB 1GB primary raid
# 2 32GB 33GB 1GB primary raid, boot ...
# 3 32GB 33GB 1GB primary boot, raid, lbx ...
# 4 32GB 33GB 1GB primary exit2 raid
# 5 32GB 33GB 1GB primary exit2 raid, boot ...
# 6 3.2kB 33GB 1GB primary
# 7 32GB 33GB 1GB primary linx-swap
# 8 32GB 33GB 1GB primary boot, lbx ...
# 9 32GB 33GB 1GB primary exit2 boot
#ret[1] ret[2] ret[3] ret[4] ret[5] ret[6] ret[7]
ret+=['','','']
ret[2]=ret[2][:-len(Partition.unit)]
ret[3]=ret[3][:-len(Partition.unit)]
ret[4]=ret[4][:-len(Partition.unit)]
if "raid" in ret[6:] or "raid," in ret[6:]:
ret[7]='yes'
if ret[6][:3].lower()=='raid' or ret[6].lower() not in fs_list:
ret[6]=''
else:
ret[7]='no'
if ret[6].lower() not in fs_list:
ret[6]=''
Partition(d+ret[1],ret[2],ret[4],ret[5],ret[6][:10] == "linux-swap" and "swap" or ret[6] ,ret[7],'yes')
@staticmethod
def init_from_xml(node):
''' create Partition instances from xml node '''
@@ -129,8 +129,8 @@ class Partition:
@staticmethod
def to_xml(doc, p_node):
''' write all Partition instance into xml
doc - xml document instance
p_node - xml node (parent node)'''
doc - xml document instance
p_node - xml node (parent node)'''
pts = doc.createElement("partitions")
unit_attr = doc.createAttribute('unit')
unit_attr.value = Partition.unit
@@ -145,14 +145,14 @@ class Partition:
size_attr = doc.createAttribute('size')
type_attr = doc.createAttribute('type')
fs_attr = doc.createAttribute('file-system')
israid_attr = doc.createAttribute('israid')
israid_attr = doc.createAttribute('israid')
from_attr = doc.createAttribute('from_os')
dev_attr.value = p.device
start_attr.value = p.start
size_attr.value = p.size
type_attr.value = p.type
fs_attr.value = p.filesystem
israid_attr.value = p.israid
israid_attr.value = p.israid
from_attr.value = p.from_os
pt.setAttributeNode(dev_attr)
pt.setAttributeNode(start_attr)
@@ -163,7 +163,7 @@ class Partition:
pt.setAttributeNode(from_attr)
pts.appendChild(pt)
p_node.appendChild(pts)
# ri_tk_cmd.py use
# ri_tk_cmd.py use
@staticmethod
def get_size(dev):
for p in Partition.list:
@@ -341,7 +341,8 @@ class MountPoint:
if mp.device == dev:
mp.directory = dir
mp.filesystem = fs
mp.format = fm
mp.format = fm
def device(self):
return self.device

View File

@@ -4,7 +4,7 @@
#
# SCRIPT NAME: ri_oper.py
#
# MENTOR: Li Zhi
# MENTOR: Li zhi
#
# AUTHOR: Ling Fen
#
@@ -26,283 +26,283 @@ display_scale = None
language = 'english'
class Rate:
''' class for installing progress, value is from 0 to 100'''
value = 0
@staticmethod
def increase(n, max=100):
if Rate.value+n <= max:
Rate.value += n
@staticmethod
def set(n):
Rate.value = n
''' class for installing progress, value is from 0 to 100'''
value = 0
@staticmethod
def increase(n, max=100):
if Rate.value+n <= max:
Rate.value += n
@staticmethod
def set(n):
Rate.value = n
class Operation:
''' This is a common base class for all install operations.
The instances of its derived class should have the following
data members:
''' This is a common base class for all install operations.
The instances of its derived class should have the following
data members:
chinese_name - operation name
english_name - operation name
script - shell script name
return_value - shell script return value
score - an abstract value, for example score is 5,
steps - the subprocess of the number of runs
current_step - the subprocess run one time
total is 100, if this operations is completed, 5% work is done.
steps - the subprocess of the number of runs
step - the subprocess run one time
total is 100, if this operations is completed, 5% work is done.
and the following methods:
get_arguments - prepare arguments for scipt
get_stdin - prepare stdin for script
install - install progress '''
install - install progress '''
def __init__(self,e,c,s,scr):
''' Operation(base class) init method
return_value is a dict, key is return code, value is a tuple, first
element is English, second element is Chinese.'''
def __init__(self,e,c,s,scr):
''' Operation(base class) init method
return_value is a dict, key is return code, value is a tuple, first
element is English, second element is Chinese.'''
self.return_value = {0:('success', u'成功'), \
1:('argument error',u'参数错误'), \
2:('deivce node do not exist',u'设备节点不存在'),\
3:('filesystem no implement',u'文件系统没有实现'),\
}
self.english_name = e
self.chinese_name = c
self.script = s
self.score = scr
self.steps = 1
self.step = 0
self.return_value = {0:('success', u'成功'), \
1:('argument error',u'参数错误'), \
2:('deivce node do not exist',u'设备节点不存在'),\
3:('filesystem no implement',u'文件系统没有实现'),\
}
self.english_name = e
self.chinese_name = c
self.script = s
self.score = scr
self.steps = 1
self.step = 0
def install(self):
if display_operation:
display_operation(language == 'chinese' and self.chinese_name or self.english_name)
def install(self):
if display_operation:
display_operation(language == 'chinese' and self.chinese_name or self.english_name)
max = Rate.value+self.score <100 and Rate.value+self.score or 100
process = subprocess.Popen("./%s " %self.script + ' '.join(self.get_arguments()),\
stdin=subprocess.PIPE,stdout=subprocess.PIPE, shell=True, \
cwd="%s/../operation"%os.path.split(os.path.realpath(__file__))[0])
process.stdin.write(self.get_stdin())
process.stdin.close()
while True:
line = process.stdout.readline()
if not line:
break
if line[0] == '@' and self.step < self.steps:
self.step += 1
if display_sub_operation:
display_sub_operation(line[1:])
Rate.increase(float(self.score)/self.steps, max)
if display_scale: display_scale()
ret = process.wait()
Rate.set(max)
if display_scale: display_scale()
return ret
max = Rate.value+self.score <100 and Rate.value+self.score or 100
process = subprocess.Popen("./%s " %self.script + ' '.join(self.get_arguments()),\
stdin=subprocess.PIPE,stdout=subprocess.PIPE, shell=True, \
cwd="%s/../operation"%os.path.split(os.path.realpath(__file__))[0])
process.stdin.write(self.get_stdin())
process.stdin.close()
while True:
line = process.stdout.readline()
if not line:
break
if line[0] == '@' and self.step < self.steps:
self.step += 1
if display_sub_operation:
display_sub_operation(line[1:])
Rate.increase(float(self.score)/self.steps, max)
if display_scale: display_scale()
ret = process.wait()
Rate.set(max)
if display_scale: display_scale()
return ret
def get_arguments(self):
return []
def get_stdin(self):
return ''
def get_arguments(self):
return []
def get_stdin(self):
return ''
class Format(Operation):
''' class for format partition '''
def __init__(self, scr):
Operation.__init__(self, 'format partition', u'格式化分区', 'format_partition.sh', scr)
self.return_value[127] = ('format partition utils not found', u'没有格式化硬盘功能')
''' class for format partition '''
def __init__(self, scr):
Operation.__init__(self, 'format partition', u'格式化分区', 'format_partition.sh', scr)
self.return_value[127] = ('format partition utils not found', u'没有格式化硬盘功能')
def get_stdin(self):
format=''
n = 0
for instance in ri_data.MountPoint.list:
if instance.format == "yes" and instance.filesystem != '':
format+="/dev/%s %s\n"%(instance.device,instance.filesystem)
n += 1
self.steps += n
return format
def get_stdin(self):
format=''
n = 0
for instance in ri_data.MountPoint.list:
if instance.format == "yes" and instance.filesystem != '':
format+="/dev/%s %s\n"%(instance.device,instance.filesystem)
n += 1
self.steps += n
return format
class MakeRaid(Operation):
"""class for make raid"""
flag=False
def __init__(self,scr):
Operation.__init__(self,"make RAID",u"正在制作RAID磁盘阵列","mkraid_wrapper.sh",scr)
def get_stdin(self):
args = ''
n = 0
for instance in ri_data.Raid.list:
if instance.from_os == 'no':
MakeRaid.flag=True
args += '-n /dev/%s -l %s -s %s -a %s\n' %(instance.device, instance.level, \
','.join([ '/dev/%s' %sp for sp in instance.spare_components]), \
','.join([ '/dev/%s' %ac for ac in instance.active_components]))
n += 1
self.steps += n
return args
"""class for make raid"""
flag=False
def __init__(self,scr):
Operation.__init__(self,"make RAID",u"正在制作RAID磁盘阵列","mkraid_wrapper.sh",scr)
def get_stdin(self):
args = ''
n = 0
for instance in ri_data.Raid.list:
if instance.from_os == 'no':
MakeRaid.flag=True
args += '-n /dev/%s -l %s -s %s -a %s\n' %(instance.device, instance.level, \
','.join([ '/dev/%s' %sp for sp in instance.spare_components]), \
','.join([ '/dev/%s' %ac for ac in instance.active_components]))
n += 1
self.steps += n
return args
class MakeRaidConfigure(Operation):
"""class for make raid configure"""
def __init__(self,scr):
Operation.__init__(self,"make raid configure file",u"配置raid配置文件","mkraidconf.sh",scr)
def install(self):
if MakeRaid.flag:
Operation.install(self)
else:
max = Rate.value+self.score <100 and Rate.value+self.score or 100
Rate.set(max)
return 0
"""class for make raid configure"""
def __init__(self,scr):
Operation.__init__(self,"make raid configure file",u"配置raid配置文件","mkraidconf.sh",scr)
def install(self):
if MakeRaid.flag:
Operation.install(self)
else:
max = Rate.value+self.score <100 and Rate.value+self.score or 100
Rate.set(max)
return 0
def get_arguments(self):
return ["/etc/mdadm.conf"]
def get_arguments(self):
return ["/etc/mdadm.conf"]
class Mount(Operation):
"""class for mount partition"""
def __init__(self,scr):
Operation.__init__(self,'mount partition',u'挂载分区','mount_partition.sh',scr)
self.return_value[2]=("device node doesn't exist",u"设备结点不存在")
"""class for mount partition"""
def __init__(self,scr):
Operation.__init__(self,'mount partition',u'挂载分区','mount_partition.sh',scr)
self.return_value[2]=("device node doesn't exist",u"设备结点不存在")
def get_stdin(self):
mount=''
n = 0
for instance in ri_data.MountPoint.list:
if instance.directory != '' and instance.filesystem !='':
mount+="/dev/%s %s %s\n"%(instance.device,instance.directory,instance.filesystem)
n += 1
self.steps += n
return mount
def get_stdin(self):
mount=''
n = 0
for instance in ri_data.MountPoint.list:
if instance.directory != '' and instance.filesystem !='':
mount+="/dev/%s %s %s\n"%(instance.device,instance.directory,instance.filesystem)
n += 1
self.steps += n
return mount
class InstallPkg(Operation):
"""class for install packages"""
def __init__(self,scr):
Operation.__init__(self,'install packages',u'安装软件包','install_pkg.sh',scr)
self.return_value[2]=("source directory pkg_source_dir doesn't exist",u"软件包所在目录不存在")
self.return_value[3]=("package in source doesn't exist",u"软件包不存在")
"""class for install packages"""
def __init__(self,scr):
Operation.__init__(self,'install packages',u'安装软件包','install_pkg.sh',scr)
self.return_value[2]=("source directory pkg_source_dir doesn't exist",u"软件包所在目录不存在")
self.return_value[3]=("package in source doesn't exist",u"软件包不存在")
def get_stdin(self):
pkgname=[]
for i in ri_data.Group.dict.values():
if i.install=='no':
continue
else:
pkgname+=i.mandatory
if i.selection=='all':
pkgname += [ j[0] for j in i.optional ]
else:
pkgname += [ j[0] for j in i.optional if j[1] == 'yes' ]
def get_stdin(self):
pkgname=[]
for i in ri_data.Group.dict.values():
if i.install=='no':
continue
else:
pkgname+=i.mandatory
if i.selection=='all':
pkgname += [ j[0] for j in i.optional ]
else:
pkgname += [ j[0] for j in i.optional if j[1] == 'yes' ]
self.steps += len(pkgname)
return '\n'.join(pkgname)
def get_arguments(self):
return ["-s","/Rocky/packages"]
self.steps += len(pkgname)
return '\n'.join(pkgname)
def get_arguments(self):
return ["-s","/Rocky/packages"]
class ConfigureFstab(Mount):
"""class for configure /etc/fstab"""
def __init__(self,scr):
Operation.__init__(self,'configure fstab',u'配置/etc/fstab文件','configure_fstab.sh',scr)
self.return_value[2]=("fstab doesn't exist",u"/etc/fstab文件不存在")
"""class for configure /etc/fstab"""
def __init__(self,scr):
Operation.__init__(self,'configure fstab',u'配置/etc/fstab文件','configure_fstab.sh',scr)
self.return_value[2]=("fstab doesn't exist",u"/etc/fstab文件不存在")
class GenerateIssue(Operation):
"""class for generate /etc/issue"""
def __init__(self,scr):
Operation.__init__(self,'generate issue',u'生成/etc/issue文件','generate_issue.sh',scr)
"""class for generate /etc/issue"""
def __init__(self,scr):
Operation.__init__(self,'generate issue',u'生成/etc/issue文件','generate_issue.sh',scr)
def get_arguments(self):
args=[]
# FIXME if tag file format is error?
if os.path.isfile("/tag") :
fd=open("/tag","r")
string = fd.read()
list = string.split('\n')[0].split('-')
args = ['-v']+[list[0][5:]]+["-a"]+[list[1]]+["-r"]+[list[2]]+['-d']+['-'.join(list[3:])]
return args
def get_arguments(self):
args=[]
# FIXME if tag file format is error?
if os.path.isfile("/tag") :
fd=open("/tag","r")
string = fd.read()
list = string.split('\n')[0].split('-')
args = ['-v']+[list[0][5:]]+["-a"]+[list[1]]+["-r"]+[list[2]]+['-d']+['-'.join(list[3:])]
return args
class ConfigureNetwork(Operation):
"""class for configure network"""
def __init__(self,scr):
Operation.__init__(self,'configure network',u'配置网络','configure_network.sh',scr)
self.return_value[2]=("ip or netmask or geteway address incorrect",u"ip或子网掩码或网关不正确")
self.return_value[3]=("hosts/resolv.conf/ifcfg-eth0/network doesn't exist",u"文件hosts、resolv.conf、ifcfg-eht0、network 不存在")
"""class for configure network"""
def __init__(self,scr):
Operation.__init__(self,'configure network',u'配置网络','configure_network.sh',scr)
self.return_value[2]=("ip or netmask or geteway address incorrect",u"ip或子网掩码或网关不正确")
self.return_value[3]=("hosts/resolv.conf/ifcfg-eth0/network doesn't exist",u"文件hosts、resolv.conf、ifcfg-eht0、network 不存在")
def get_arguments(self):
network=''
data=ri_data.Network
if data.configuration == "static":
network+="-t static "
if data.hostname is not '':
network+="-h %s "%data.hostname
if data.domain is not '':
network+="-d %s "%data.domain
if data.ip is not '':
network+="-i %s "%data.ip
if data.mask is not '':
network+="-n %s "%data.mask
if data.gateway is not '':
network+="-g %s "%data.gateway
if data.primary_dns is not '':
network+="-p %s "%data.primary_dns
if data.secondary_dns is not '':
network+="-s %s "%data.secondary_dns
else:
network+="-t dynamic "
if data.hostname is not '':
network+="-h %s "%data.hostname
return [network]
def get_arguments(self):
network=''
data=ri_data.Network
if data.configuration == "static":
network+="-t static "
if data.hostname is not '':
network+="-h %s "%data.hostname
if data.domain is not '':
network+="-d %s "%data.domain
if data.ip is not '':
network+="-i %s "%data.ip
if data.mask is not '':
network+="-n %s "%data.mask
if data.gateway is not '':
network+="-g %s "%data.gateway
if data.primary_dns is not '':
network+="-p %s "%data.primary_dns
if data.secondary_dns is not '':
network+="-s %s "%data.secondary_dns
else:
network+="-t dynamic "
if data.hostname is not '':
network+="-h %s "%data.hostname
return [network]
class MakeServiceAutoBoot(Operation):
"""class for make service autoboot"""
def __init__(self,scr):
Operation.__init__(self,"make service autoboot",u"启动服务器","mk_serv_autoboot.sh",scr)
self.return_value[2]=("boot script doesn't exist",u"引导脚本不存在")
def get_stdin(self):
serv=''
n = 0
for i in ri_data.Service.list:
if i.start == "yes":
serv+='%s %s %s %s\n'%(i.package,i.script,i.name,i.number)
n += 1
self.steps += n
return serv
"""class for make service autoboot"""
def __init__(self,scr):
Operation.__init__(self,"make service autoboot",u"启动服务器","mk_serv_autoboot.sh",scr)
self.return_value[2]=("boot script doesn't exist",u"引导脚本不存在")
def get_stdin(self):
serv=''
n = 0
for i in ri_data.Service.list:
if i.start == "yes":
serv+='%s %s %s %s\n'%(i.package,i.script,i.name,i.number)
n += 1
self.steps += n
return serv
class CopyKernel(Operation):
"""class for copy kernel"""
def __init__(self,scr):
Operation.__init__(self,"copy kernle",u"拷贝内核","copy_kernels.sh",scr)
self.return_value[1]=("kernel directory/modules directory/initrd.gz/makeinitrd doesn't exist",u"内核目录、模块目录、initrd.gz、makeinitrd 不存在")
"""class for copy kernel"""
def __init__(self,scr):
Operation.__init__(self,"copy kernle",u"拷贝内核","copy_kernels.sh",scr)
self.return_value[1]=("kernel directory/modules directory/initrd.gz/makeinitrd doesn't exist",u"内核目录、模块目录、initrd.gz、makeinitrd 不存在")
class ExecFinishInstall(Operation):
"""class for exec finish install"""
def __init__(self,scr):
Operation.__init__(self,"exec finish install",u"安装完成执行的脚本","exec_finish_install.sh",scr)
def get_stdin(self):
return "99finish_install.sh\n"
"""class for exec finish install"""
def __init__(self,scr):
Operation.__init__(self,"exec finish install",u"安装完成执行的脚本","exec_finish_install.sh",scr)
def get_stdin(self):
return "99finish_install.sh\n"
class BootLoader(Operation):
"""class for bootloader"""
def __init__(self,scr):
Operation.__init__(self,"install bootloader",u"安装引导程序","install_bootloader.sh",scr)
self.return_value[2]=("bootloader type doesn't specify",u"没有指定引导程序的类型")
self.return_value[3]=("bootloader no implement",u"没有执行bootloader")
self.return_value[127]=("bootloader utils not found",u"没发现bootloader的utils")
"""class for bootloader"""
def __init__(self,scr):
Operation.__init__(self,"install bootloader",u"安装引导程序","install_bootloader.sh",scr)
self.return_value[2]=("bootloader type doesn't specify",u"没有指定引导程序的类型")
self.return_value[3]=("bootloader no implement",u"没有执行bootloader")
self.return_value[127]=("bootloader utils not found",u"没发现bootloader的utils")
def get_arguments(self):
# only grub?
return ["-t grub"]
def get_arguments(self):
# only grub?
return ["-t grub"]
class ConfigureBootloader(Operation):
"""class for configure bootloader file"""
def __init__(self,scr):
Operation.__init__(self,"configure bootloader",u"配置bootloader","configure_bootloader_cnf.sh",scr)
self.return_value[2]=("bootloader type doesn't specify",u"没有指定引导程序的类型")
self.return_value[3]=("bootloader configure file doesn't exist",u"引导程序配置文件不存在")
self.return_value[4]=("bootloader configuration file doesn't exist",u"引导程序配置文件不存在")
"""class for configure bootloader file"""
def __init__(self,scr):
Operation.__init__(self,"configure bootloader",u"配置bootloader","configure_bootloader_cnf.sh",scr)
self.return_value[2]=("bootloader type doesn't specify",u"没有指定引导程序的类型")
self.return_value[3]=("bootloader configure file doesn't exist",u"引导程序配置文件不存在")
self.return_value[4]=("bootloader configuration file doesn't exist",u"引导程序配置文件不存在")
def get_arguments(self):
bootloader=[]
# FIXME if tag file format is error?
if os.path.isfile("/tag"):
fd = open("/tag","r")
string = fd.read()
list = string.split('-')
for instance in ri_data.MountPoint.list:
if instance.directory == '/':
# only grub?
bootloader=['-t','grub','-r',instance.device,'-k',ri_data.SerialNumber.value,'-o',list[0][5:].split('.')[0]+'.'+list[0][5:].split('.')[1]]
break
return bootloader
def get_arguments(self):
bootloader=[]
# FIXME if tag file format is error?
if os.path.isfile("/tag"):
fd = open("/tag","r")
string = fd.read()
list = string.split('-')
for instance in ri_data.MountPoint.list:
if instance.directory == '/':
# only grub?
bootloader=['-t','grub','-r',instance.device,'-k',ri_data.SerialNumber.value,'-o',list[0][5:].split('.')[0]+'.'+list[0][5:].split('.')[1]]
break
return bootloader