Просмотр исходного кода

[OSMorphing] Add automatic `dpkg --configure` step before installing packages.

Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
Nashwan Azhari 2 лет назад
Родитель
Сommit
4c40b7aa6e
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      coriolis/osmorphing/debian.py

+ 8 - 0
coriolis/osmorphing/debian.py

@@ -147,6 +147,14 @@ class BaseDebianMorphingTools(base.BaseLinuxOSMorphingTools):
 
     def install_packages(self, package_names):
         try:
+            # NOTE(aznashwan): in the rare event that a replica sync occurs
+            # while the source machine was midway through installing or
+            # configuring a package, forcing it to retain old conf files
+            # which were previously modified on the source machine.
+            deb_reconfigure_cmd = (
+                "dpkg --configure --force-confold -a")
+            self._exec_cmd_chroot(deb_reconfigure_cmd)
+
             apt_get_cmd = (
                 '/bin/bash -c "DEBIAN_FRONTEND=noninteractive '
                 'apt-get install %s -y '