48 lines
1.8 KiB
Diff
48 lines
1.8 KiB
Diff
|
From 1cc680adf1d63028c0b5f79544b6bd9e501b249e Mon Sep 17 00:00:00 2001
|
||
|
From: Michal Reznik <mreznik@redhat.com>
|
||
|
Date: Fri, 13 May 2022 12:00:15 +0200
|
||
|
Subject: [PATCH 38/39] Remove temporary leapp directory in /root
|
||
|
|
||
|
Leaving the directory behind will cause issues during upgrades to
|
||
|
another major verison. E.g in case of RHEL 7 > RHEL 8 > RHEL 9
|
||
|
upgrade.
|
||
|
---
|
||
|
.../preparepythonworkround/libraries/workaround.py | 11 +++++++++--
|
||
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/repos/system_upgrade/common/actors/preparepythonworkround/libraries/workaround.py b/repos/system_upgrade/common/actors/preparepythonworkround/libraries/workaround.py
|
||
|
index f61c78cf..de3079ee 100644
|
||
|
--- a/repos/system_upgrade/common/actors/preparepythonworkround/libraries/workaround.py
|
||
|
+++ b/repos/system_upgrade/common/actors/preparepythonworkround/libraries/workaround.py
|
||
|
@@ -1,7 +1,9 @@
|
||
|
import os
|
||
|
+import shutil
|
||
|
import sys
|
||
|
|
||
|
from leapp.libraries.common.utils import makedirs
|
||
|
+from leapp.libraries.stdlib import api
|
||
|
|
||
|
LEAPP_HOME = '/root/tmp_leapp_py3'
|
||
|
|
||
|
@@ -18,10 +20,15 @@ def _get_orig_leapp_path():
|
||
|
|
||
|
def apply_python3_workaround():
|
||
|
py3_leapp = os.path.join(LEAPP_HOME, 'leapp3')
|
||
|
+ if os.path.exists(LEAPP_HOME):
|
||
|
+ try:
|
||
|
+ shutil.rmtree(LEAPP_HOME)
|
||
|
+ except OSError as e:
|
||
|
+ api.current_logger().error('Could not remove {} directory: {}'.format(LEAPP_HOME, str(e)))
|
||
|
+
|
||
|
makedirs(LEAPP_HOME)
|
||
|
leapp_lib_symlink_path = os.path.join(LEAPP_HOME, 'leapp')
|
||
|
- if not os.path.exists(leapp_lib_symlink_path):
|
||
|
- os.symlink(_get_orig_leapp_path(), leapp_lib_symlink_path)
|
||
|
+ os.symlink(_get_orig_leapp_path(), leapp_lib_symlink_path)
|
||
|
with open(py3_leapp, 'w') as f:
|
||
|
f_content = [
|
||
|
'#!/usr/bin/python3',
|
||
|
--
|
||
|
2.35.3
|
||
|
|