|
|
@@ -76,6 +76,12 @@ class BaseLinuxOSMorphingTools(BaseOSMorphingTools):
|
|
|
|
|
|
return add, remove
|
|
|
|
|
|
+ def pre_packages_install(self):
|
|
|
+ self._copy_resolv_conf()
|
|
|
+
|
|
|
+ def post_packages_install(self):
|
|
|
+ self._restore_resolv_conf()
|
|
|
+
|
|
|
def _test_path(self, chroot_path):
|
|
|
path = os.path.join(self._os_root_dir, chroot_path)
|
|
|
return utils.test_ssh_path(self._ssh, path)
|
|
|
@@ -133,3 +139,20 @@ class BaseLinuxOSMorphingTools(BaseOSMorphingTools):
|
|
|
name, value = m.groups()
|
|
|
config[name] = value
|
|
|
return config
|
|
|
+
|
|
|
+ def _copy_resolv_conf(self):
|
|
|
+ resolv_conf_path = os.path.join(self._os_root_dir, "etc/resolv.conf")
|
|
|
+ resolv_conf_path_old = "%s.old" % resolv_conf_path
|
|
|
+
|
|
|
+ if self._test_path(resolv_conf_path):
|
|
|
+ self._exec_cmd(
|
|
|
+ "sudo mv -f %s %s" % (resolv_conf_path, resolv_conf_path_old))
|
|
|
+ self._exec_cmd("sudo cp /etc/resolv.conf %s" % resolv_conf_path)
|
|
|
+
|
|
|
+ def _restore_resolv_conf(self):
|
|
|
+ resolv_conf_path = os.path.join(self._os_root_dir, "etc/resolv.conf")
|
|
|
+ resolv_conf_path_old = "%s.old" % resolv_conf_path
|
|
|
+
|
|
|
+ if self._test_path(resolv_conf_path_old):
|
|
|
+ self._exec_cmd(
|
|
|
+ "sudo mv -f %s %s" % (resolv_conf_path_old, resolv_conf_path))
|