Compare commits

..

12 Commits

Author SHA1 Message Date
openeuler-ci-bot
6040f272e4
!157 update the initiazation repo file
From: @xuezhizone 
Reviewed-by: @xingwei-liu 
Signed-off-by: @xingwei-liu
2024-11-12 01:26:31 +00:00
xuezhixin
bcb6b893d0 update the initiazation repo file 2024-11-12 09:15:30 +08:00
openeuler-ci-bot
93276176b7
!156 add interface in agent
From: @xuezhizone 
Reviewed-by: @xingwei-liu 
Signed-off-by: @xingwei-liu
2024-11-11 10:21:09 +00:00
xuezhixin
16a867bc76 add interface in agent 2024-11-11 18:11:44 +08:00
openeuler-ci-bot
52c3637284
!155 add task to check repo
From: @xuezhizone 
Reviewed-by: @xingwei-liu 
Signed-off-by: @xingwei-liu
2024-11-11 09:59:01 +00:00
xuezhixin
366e35b879 add task to check repo 2024-11-11 17:49:28 +08:00
openeuler-ci-bot
97e55ca9cc
!154 export migration log
From: @xuezhizone 
Reviewed-by: @xingwei-liu 
Signed-off-by: @xingwei-liu
2024-11-11 09:49:19 +00:00
xuezhixin
ee7c2db9dc export migration log 2024-11-11 17:33:29 +08:00
openeuler-ci-bot
943a949619
!153 agent sends the task after receving the request
From: @xuezhizone 
Reviewed-by: @xingwei-liu 
Signed-off-by: @xingwei-liu
2024-11-11 09:33:22 +00:00
openeuler-ci-bot
01fdfddafa
!152 compare with agent ip
From: @xuezhizone 
Reviewed-by: @xingwei-liu 
Signed-off-by: @xingwei-liu
2024-11-11 09:25:27 +00:00
xuezhixin
130dcc214c agent sends the task after receving the request 2024-11-11 17:22:00 +08:00
xuezhixin
84c12a11a3 compare with agent ip 2024-11-11 17:13:15 +08:00
7 changed files with 565 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From 3b4ff69c1c59e004fe8c8b60220cf98e0461d847 Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 16:24:00 +0800
Subject: [PATCH] =?UTF-8?q?IP=E6=98=AF=E5=90=A6=E5=92=8C=E8=AF=B7=E6=B1=82?=
=?UTF-8?q?=E7=9A=84agent=E7=9A=84IP=E5=8C=B9=E9=85=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/fork.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py
index 23c10e2..8ad6d59 100644
--- a/sysmig_agent/fork.py
+++ b/sysmig_agent/fork.py
@@ -256,3 +256,13 @@ def system_migration(data):
timed_task_migrate(task_id, kernel_version)
post_server('task_close', task_id)
+
+def if_env_check(data):
+ agent_ips = list(json.loads(data).get('agent_ip'))
+ for n in range(len(agent_ips)):
+ ip = str(agent_ips[n])
+ if ip == get_local_ip():
+ return True
+ return False
+
+
--
2.20.1

View File

@ -0,0 +1,41 @@
From f9a676fb7297beb5e40af2fc39e1c872c33ffded Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 16:30:34 +0800
Subject: [PATCH] =?UTF-8?q?agent=E6=94=B6=E5=88=B0=E8=AF=B7=E6=B1=82?=
=?UTF-8?q?=E5=90=8E=E5=88=86=E5=8F=91=E4=BB=BB=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/fork.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/sysmig_agent/fork.py b/sysmig_agent/fork.py
index 8ad6d59..679fb21 100644
--- a/sysmig_agent/fork.py
+++ b/sysmig_agent/fork.py
@@ -266,3 +266,20 @@ def if_env_check(data):
return False
+def post_task(data):
+ task_mod = json.loads(data).get('mod')
+ if 'check_info' == task_mod:
+ t = threading.Thread(target=check_info, args=[data])
+ elif 'check_repo' == task_mod:
+ t = threading.Thread(target=check_repo, args=[data])
+ elif 'check_kernel' == task_mod:
+ t = threading.Thread(target=check_kernel, args=[data])
+ elif 'check_environment' == task_mod:
+ if if_env_check(data):
+ t = threading.Thread(target=check_environment, args=[data])
+ elif 'system_migration' == task_mod:
+ t = threading.Thread(target=system_migration, args=[data])
+ t.start()
+ return 'y'
+
+
--
2.20.1

View File

@ -0,0 +1,70 @@
From fa9113d9f5c7ba0d80835d9e5dfb683aca9834a7 Mon Sep 17 00:00:00 2001
From: lixin <lixinb@uniontech.com>
Date: Mon, 13 Nov 2023 16:33:44 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=81=E7=A7=BB=E6=97=A5?=
=?UTF-8?q?=E5=BF=97=E5=AF=BC=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.py | 1 +
views/reports.py | 18 ++++++++++++++++++
views/server.py | 1 +
3 files changed, 20 insertions(+)
diff --git a/index.py b/index.py
index 505e91f..a392531 100644
--- a/index.py
+++ b/index.py
@@ -36,6 +36,7 @@ mods = {
'get_environment_data': server.get_environment_data,
'get_repo_arch_info': server.get_repo_arch_info,
'get_storage_num': server.get_storage_num,
+ 'export_reports': server.export_reports,
}
diff --git a/views/reports.py b/views/reports.py
index 6295283..c616dfd 100644
--- a/views/reports.py
+++ b/views/reports.py
@@ -22,4 +22,22 @@ def migration_detection(data):
migration_log.info(scp_log)
except:
migration_log.error('export report scp error:%s' % scp_log)
+ return 'success'
+
+
+def migration_logs(data):
+ """
+ 迁移日志
+ :return:
+ """
+ agent_ip = data.get('agent_ip')
+ info_sql = "select AES_DECRYPT(agent_passwd, 'coco'),agent_username from agent_info where agent_ip='%s'" % agent_ip
+ info = DBHelper().execute(info_sql).fetchall()
+ scp_log = "sshpass -p %s scp -r %s@%s:/var/tmp/uos-migration/UOS_migration_log*.tar.gz /var/uos-migration/" % \
+ (str(info[0][0], encoding="utf-8"), info[0][1], agent_ip)
+ try:
+ os.system(scp_log)
+ migration_log.info(scp_log)
+ except:
+ migration_log.error('export report scp error:%s' % scp_log)
return 'success'
\ No newline at end of file
diff --git a/views/server.py b/views/server.py
index 4cfab8f..7c17a2f 100644
--- a/views/server.py
+++ b/views/server.py
@@ -353,6 +353,7 @@ def get_storage_num(data):
reports_type = {
"migration_detection": reports.migration_detection,
+ "migration_logs": reports.migration_logs,
}
def export_reports(data):
--
2.20.1

View File

@ -0,0 +1,272 @@
From 0e6f8d8f1bb7dba15a206b7a02c9dc70ad9b1aba Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 16:39:51 +0800
Subject: [PATCH] =?UTF-8?q?agent=E6=A3=80=E6=B5=8Brepo=E4=BB=BB=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/check.py | 93 ------------------------
sysmig_agent/short_task.py | 144 +++++++++++++++++++++++++++++++++++++
2 files changed, 144 insertions(+), 93 deletions(-)
diff --git a/sysmig_agent/check.py b/sysmig_agent/check.py
index 141a734..1a21c52 100644
--- a/sysmig_agent/check.py
+++ b/sysmig_agent/check.py
@@ -178,99 +178,6 @@ def check_user(data):
return re_data
-def init_remove_oldrepo():
- backup_comment = '#This is a yum repository file that was disabled . <Migration to UiniontechOS> \
- \n'
- path = '/etc/yum.repos.d/'
- repos = os.listdir(path)
- for repo in repos:
- path_file = path+'/'+repo
- if not os.path.isfile(path_file):
- continue
- if not re.search('repo$',repo):
- continue
- with open(path_file, 'r') as fsrc:
- content = fsrc.read()
- with open(path_file+'.disabled','w') as fdst:
- fdst.write(repo+'\n'+backup_comment+content)
- fdst.close()
- fsrc.close()
- os.remove(path_file)
-
-
-#初始化repo文件
-def initRepoFile(baseurl):
- os_version_ret = platform.dist()
- version = os_version_ret[1].split('.',-1)
- reposdir = '/etc/yum.repos.d/'
- h = 0
- if re.match('file:',baseurl):
- str0, path = baseurl.split('://',1)
- path = '/' + path.strip('/') + '/'
- else:
- h = 1
- if re.fullmatch('8',version[0]):
- path_appstream = baseurl+'/AppStream'
- path_baseos = baseurl+'/BaseOS'
- path_310 = baseurl+'/kernel-3.10'
- path_419 = baseurl+'/kernel419'
- path_510 = baseurl+'/kernel510'
-
- repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+path_appstream.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-BaseOS]\nname = UniontechOS BaseOS\nbaseurl = '''+path_baseos.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-4.19.0]\nname = UniontechOS Kernel-4.19.0\nbaseurl = '''+path_419.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-5.10.0]\nname = UniontechOS Kernel-5.10.0\nbaseurl = '''+path_510.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n
-'''
- else:
- path_310 = baseurl+'/kernel-3.10'
- repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+baseurl.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-3.10.0]\nname = UniontechOS Kernel-3.10.0\nbaseurl = '''+path_310.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n
- '''
- repofile = os.path.join(reposdir, 'switch-to-uos.repo')
- with open(repofile,'w') as f_repo:
- f_repo.write(repostr_uos)
- f_repo.close()
-
-
-#检测repo文件创建缓存
-def checkRepoMakeCache():
- os.system('yum clean all')
- os.system('yum makecache')
- os_version_ret = platform.dist()
- os_arch = platform.machine()
- version = os_version_ret[1].split('.',-1)
- ret = os.path.exists('/var/cache/dnf/UniontechOS-AppStream.solv')
- if ret:
- ret = os.path.exists('/var/cache/dnf/UniontechOS-BaseOS.solv')
- if ret or re.fullmatch('7',version[0]):
- return 0
- else:
- return 1
- else:
- if re.fullmatch('7',version[0]):
- ret = os.path.exists('/var/cache/yum/%s/7/UniontechOS-AppStream/repomd.xml' % os_arch)
- if ret:
- return 0
- return 1
-
-
-#检测repo
-def check_repo(data_j):
- uos_sysmig_conf = json.loads(getSysMigConf())
- AGENT_IP = json.loads(uos_sysmig_conf).get('agentip').strip()[1:-1]
- baseurl = json.loads(data_j).get('repo_pwd')
- keylist = None
- valuelist = None
- data = None
- init_remove_oldrepo()
- initRepoFile(baseurl)
- state = checkRepoMakeCache()
-
- if state == 0:
- keylist = ['ip','res','data']
- valuelist = [AGENT_IP,state,'连接成功']
- else:
- data = '下载失败,请检查您的软件源'
- keylist = ['ip','res','error']
- valuelist = [AGENT_IP,state,data]
- return list_to_json(keylist,valuelist)
-
def check_os_kernel(data):
uos_sysmig_conf = json.loads(getSysMigConf())
diff --git a/sysmig_agent/short_task.py b/sysmig_agent/short_task.py
index 11dd9ef..4e4dae3 100644
--- a/sysmig_agent/short_task.py
+++ b/sysmig_agent/short_task.py
@@ -138,3 +138,147 @@ def get_agent_os():
AGENT_OS = os_version_ret[0] + version[0]
return AGENT_OS
+
+
+def init_remove_oldrepo():
+ backup_comment = '#This is a yum repository file that was disabled . <Migration to UiniontechOS> \
+ \n'
+ path = '/etc/yum.repos.d/'
+ repos = os.listdir(path)
+ for repo in repos:
+ path_file = path+'/'+repo
+ if not os.path.isfile(path_file):
+ continue
+ if not re.search('repo$',repo):
+ continue
+ with open(path_file, 'r') as fsrc:
+ content = fsrc.read()
+ with open(path_file+'.disabled','w') as fdst:
+ fdst.write(repo+'\n'+backup_comment+content)
+ fdst.close()
+ fsrc.close()
+ os.remove(path_file)
+
+
+#初始化repo文件
+def initRepoFile(baseurl):
+ os_version_ret = platform.dist()
+ version = os_version_ret[1].split('.',-1)
+ reposdir = '/etc/yum.repos.d/'
+ h = 0
+ if re.match('file:',baseurl):
+ str0, path = baseurl.split('://',1)
+ path = '/' + path.strip('/') + '/'
+ else:
+ h = 1
+ if re.fullmatch('8',version[0]):
+ path_appstream = baseurl+'/AppStream'
+ path_baseos = baseurl+'/BaseOS'
+ path_310 = baseurl+'/kernel-3.10'
+ path_419 = baseurl+'/kernel419'
+ path_510 = baseurl+'/kernel510'
+
+ repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+path_appstream.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-BaseOS]\nname = UniontechOS BaseOS\nbaseurl = '''+path_baseos.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-4.19.0]\nname = UniontechOS Kernel-4.19.0\nbaseurl = '''+path_419.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-5.10.0]\nname = UniontechOS Kernel-5.10.0\nbaseurl = '''+path_510.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n
+'''
+ else:
+ path_310 = baseurl+'/kernel-3.10'
+ repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+baseurl.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-3.10.0]\nname = UniontechOS Kernel-3.10.0\nbaseurl = '''+path_310.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n
+ '''
+ repofile = os.path.join(reposdir, 'switch-to-uos.repo')
+ with open(repofile,'w') as f_repo:
+ f_repo.write(repostr_uos)
+ f_repo.close()
+
+
+#检测repo文件创建缓存
+def checkRepoMakeCache():
+ os.system('yum clean all')
+ os.system('yum makecache')
+ os_version_ret = platform.dist()
+ os_arch = platform.machine()
+ version = os_version_ret[1].split('.',-1)
+ ret = os.path.exists('/var/cache/dnf/UniontechOS-AppStream.solv')
+ if ret:
+ ret = os.path.exists('/var/cache/dnf/UniontechOS-BaseOS.solv')
+ if ret or re.fullmatch('7',version[0]):
+ return 0
+ else:
+ return 1
+ else:
+ if re.fullmatch('7',version[0]):
+ ret = os.path.exists('/var/cache/yum/%s/7/UniontechOS-AppStream/repomd.xml' % os_arch)
+ if ret:
+ return 0
+ return 1
+
+
+# 检测centos 8 系统上的 repo文件联通
+def checkRepoFileHttp(baseurl):
+ try:
+ with request.urlopen(baseurl) as file:
+ # print(file.status)
+ # print(file.reason)
+ if re.match('OK', file.reason):
+ return 0
+ except Exception as e:
+ if re.match('HTTP Error 404|[Errno 2]', str(e)):
+ return 1
+ elif re.match('[Errno 21]', str(e)):
+ return 0
+ else:
+ return 1
+
+
+def repoFileCheck(baseurl):
+ if re.match('file\:\/\/', baseurl):
+ path = re.sub('file://', '', baseurl)
+ if os.path.exists(path):
+ return 0
+ else:
+ return 1
+ try:
+ dst_status = urllib.request.urlopen(baseurl, timeout=5).code
+ return 0
+ except Exception as err:
+ return 1
+ pass
+
+def check_repo(data):
+ agent_os = get_agent_os()
+ if '7' in agent_os:
+ agent_os = 'centos7'
+ elif '8' in agent_os:
+ agent_os = 'centos8'
+ os_type = agent_os + '_' + platform.machine().strip('')
+ baseurl = json.loads(data).get(os_type)
+ if not baseurl:
+ baseurl = '1'
+ task_id = json.loads(data).get('task_id')
+ # 更新SQL任务状态
+ statue = 1
+ sql_task_statue(statue, task_id)
+ # 发送消息给Server更新任务流状态
+ post_server('task_start', task_id)
+ # 初始化去除旧的repo文件
+ init_remove_oldrepo()
+ # 传递baseurl配置repo文件
+ initRepoFile(baseurl)
+ # 建立软件源缓存,判断软件源是否可用
+ state = checkRepoMakeCache()
+ sql = ''
+ repo_state = -1
+ if state == 0:
+ repo_state = repoFileCheck(baseurl)
+ else:
+ repo_state = 1
+
+ sql = "UPDATE agent_info SET repo_status = {} WHERE agent_ip = '{}';".format(repo_state, get_local_ip())
+ try:
+ ret = DBHelper().execute(sql)
+ statue = 2
+ except:
+ statue = 2
+ sql_task_statue(statue, task_id)
+ sql_task_statue(statue, task_id)
+ post_server('task_close', task_id)
+ return 'success'
--
2.20.1

View File

@ -0,0 +1,37 @@
From 26c0cd76dff728aee9bb24aa23a62258eb76a1d8 Mon Sep 17 00:00:00 2001
From: lixin <lixinb@uniontech.com>
Date: Mon, 13 Nov 2023 17:15:51 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/index.py b/index.py
index a392531..06a44c3 100644
--- a/index.py
+++ b/index.py
@@ -204,6 +204,17 @@ def export_reports():
return Response(mod, content_type='application/json')
+@app.route('/get_page_data', methods=['GET', 'POST'])
+def get_page_data():
+ """
+ 定时获取可用空间页面数据
+ :return:
+ """
+ mod = check_methods()
+ if mod:
+ return Response(mod, content_type='application/json')
+
+
@app.route('/', methods=['GET', 'POST'])
def MT_index():
"""
--
2.20.1

View File

@ -0,0 +1,86 @@
From 0e49cc38358147a06f2ddcb0888553eb57e47274 Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Tue, 14 Nov 2023 09:37:02 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=9D=E5=A7=8B=E5=8C=96re?=
=?UTF-8?q?pos=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/short_task.py | 46 ++++++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 17 deletions(-)
diff --git a/sysmig_agent/short_task.py b/sysmig_agent/short_task.py
index 4e4dae3..2ef4ac6 100644
--- a/sysmig_agent/short_task.py
+++ b/sysmig_agent/short_task.py
@@ -160,36 +160,48 @@ def init_remove_oldrepo():
os.remove(path_file)
-#初始化repo文件
+# 初始化repo文件
def initRepoFile(baseurl):
os_version_ret = platform.dist()
- version = os_version_ret[1].split('.',-1)
- reposdir = '/etc/yum.repos.d/'
+ version = os_version_ret[1].split('.', -1)
+ AGENT_OS = os_version_ret[0] + version[0]
+ if re.search('7', AGENT_OS):
+ reposdir = '/etc/yum.repos.d/'
+ else:
+ reposdir = '/etc/yum.repos.d/'
+ # reposdir = dnf.Base().conf.get_reposdir
h = 0
- if re.match('file:',baseurl):
- str0, path = baseurl.split('://',1)
+ if re.search('file', baseurl):
+ str0, path = baseurl.split('://', 1)
path = '/' + path.strip('/') + '/'
else:
- h = 1
- if re.fullmatch('8',version[0]):
- path_appstream = baseurl+'/AppStream'
- path_baseos = baseurl+'/BaseOS'
- path_310 = baseurl+'/kernel-3.10'
- path_419 = baseurl+'/kernel419'
- path_510 = baseurl+'/kernel510'
+ h = 1
+ if re.fullmatch('8', version[0]):
+ path_appstream = baseurl + '/AppStream'
+ path_baseos = baseurl + '/BaseOS'
+ path_310 = baseurl + '/kernel-3.10'
+ path_418 = baseurl + '/kernel-4.18'
+ path_419 = baseurl + '/kernel419'
+ path_510 = baseurl + '/kernel510'
- repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+path_appstream.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-BaseOS]\nname = UniontechOS BaseOS\nbaseurl = '''+path_baseos.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-4.19.0]\nname = UniontechOS Kernel-4.19.0\nbaseurl = '''+path_419.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-5.10.0]\nname = UniontechOS Kernel-5.10.0\nbaseurl = '''+path_510.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n
+ repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = ''' + path_appstream.strip(
+ '\n') + '''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-BaseOS]\nname = UniontechOS BaseOS\nbaseurl = ''' + path_baseos.strip(
+ '\n') + '''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-4.18.0]\nname = UniontechOS Kernel-4.18.0\nbaseurl = ''' + path_418.strip(
+ '\n') + '''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-4.19.0]\nname = UniontechOS Kernel-4.19.0\nbaseurl = ''' + path_419.strip(
+ '\n') + '''\nenabled = 1\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-5.10.0]\nname = UniontechOS Kernel-5.10.0\nbaseurl = ''' + path_510.strip(
+ '\n') + '''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n
'''
else:
- path_310 = baseurl+'/kernel-3.10'
- repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+baseurl.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-3.10.0]\nname = UniontechOS Kernel-3.10.0\nbaseurl = '''+path_310.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n
+ path_310 = baseurl + '/kernel-3.10'
+ repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = ''' + baseurl.strip(
+ '\n') + '''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-3.10.0]\nname = UniontechOS Kernel-3.10.0\nbaseurl = ''' + path_310.strip(
+ '\n') + '''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n
'''
repofile = os.path.join(reposdir, 'switch-to-uos.repo')
- with open(repofile,'w') as f_repo:
+ with open(repofile, 'w') as f_repo:
f_repo.write(repostr_uos)
f_repo.close()
-
#检测repo文件创建缓存
def checkRepoMakeCache():
os.system('yum clean all')
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.3
Release: 13
Release: 19
License: MulanPSL-2.0
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
Source0: %{name}-%{version}.tar.gz
@ -20,6 +20,12 @@ Patch010: 0010-update-abi-result-to-database.patch
Patch011: 0011-initializate-the-migration-status.patch
Patch012: 0012-get-agent-kernel-version.patch
Patch013: 0013-set-agent-migration-task.patch
Patch014: 0014-compare-with-request-agent-ip.patch
Patch015: 0015-agent-sends-the-task-after-receving-the-request.patch
Patch016: 0016-export-migration-log.patch
Patch017: 0017-add-task-to-check-repo.patch
Patch018: 0018-add-interface-in-agent.patch
Patch019: 0019-update-the-initilization-repo-file.patch
BuildArch: noarch
@ -119,6 +125,24 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-19
- 0019-update-the-initilization-repo-file.patch
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-18
- 0018-add-interface-in-agent.patch
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-17
- 0017-add-task-to-check-repo.patch
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-16
- 0016-export-migration-log.patch
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-15
- 0015-agent-sends-the-task-after-receving-the-request.patch
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-14
- 0014-compare-with-request-agent-ip.patch
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-13
- 0013-set-agent-migration-task.patch