os.symlink(target, link_name) fails if the link_name already exists. So try to
remove it first.
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/timezone.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/pyanaconda/timezone.py b/pyanaconda/timezone.py
index b7bc559..3127626 100644
--- a/pyanaconda/timezone.py
+++ b/pyanaconda/timezone.py
@@ -57,6 +57,12 @@ def write_timezone_config(timezone, root):
log.error("Timezone to be linked (%s) doesn't exist" %
rooted_tz_file)
else:
try:
+ try:
+ # os.symlink fails if file exists, so try to remove it first
+ os.remove(link_path)
+ except OSError:
+ pass
+
os.symlink(relative_path, link_path)
except OSError as oserr:
log.error("Error when symlinking timezone (from %s): %s" % \
--
1.7.11.4