[rhel7] Don't install langpacks.conf if nowhere to install to (#1172004)

David Shea dshea at redhat.com
Tue Dec 16 20:12:02 UTC 2014


Some installations don't install yum. Some installations don't really
care about the langpacks config.

Resolves: rhbz#1172004
---
 pyanaconda/packaging/yumpayload.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 4b038ec..19eb0fd 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -255,8 +255,15 @@ class YumPayload(PackagePayload):
             f.write("langpack_locales = %s\n" % ", ".join(langs))
 
     def _copyLangpacksConfigToTarget(self):
-        shutil.copy2(_yum_installer_langpack_conf,
-                     iutil.getSysroot()+_yum_target_langpack_conf)
+        target_langpack_conf = iutil.getSysroot() + _yum_target_langpack_conf
+
+        # The directory for the config may not exist if yum was not installed
+        # to the target. If this is the case, skip installing the config.
+        if not os.path.exists(os.path.dirname(target_langpack_conf)):
+            log.debug("langpack directory not found, not copying langpacks.conf to taget")
+        else:
+            shutil.copy2(_yum_installer_langpack_conf,
+                         target_langpack_conf)
 
     def _writeYumConfig(self):
         """ Write out anaconda's main yum configuration file. """
-- 
2.1.0



More information about the anaconda-patches mailing list