Przeglądaj źródła

Fix resolv conf test path

Cristian Matiut 9 miesięcy temu
rodzic
commit
44ab10feac
1 zmienionych plików z 7 dodań i 4 usunięć
  1. 7 4
      coriolis/osmorphing/base.py

+ 7 - 4
coriolis/osmorphing/base.py

@@ -330,20 +330,23 @@ class BaseLinuxOSMorphingTools(BaseOSMorphingTools):
             self._ssh, full_path, check_exists=check_exists)
 
     def _copy_resolv_conf(self):
-        resolv_conf_path = os.path.join(self._os_root_dir, "etc/resolv.conf")
+        resolv_conf = "etc/resolv.conf"
+        resolv_conf_path = os.path.join(self._os_root_dir, resolv_conf)
         resolv_conf_path_old = "%s.old" % resolv_conf_path
 
-        if self._test_path(resolv_conf_path):
+        if self._test_path(resolv_conf):
             self._exec_cmd(
                 "sudo mv -f %s %s" % (resolv_conf_path, resolv_conf_path_old))
         self._exec_cmd('sudo cp -L --remove-destination /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 = "etc/resolv.conf"
+        resolv_conf_old = "%s.old" % resolv_conf
+        resolv_conf_path = os.path.join(self._os_root_dir, resolv_conf)
         resolv_conf_path_old = "%s.old" % resolv_conf_path
 
-        if self._test_path(resolv_conf_path_old):
+        if self._test_path(resolv_conf_old):
             self._exec_cmd(
                 "sudo mv -f %s %s" % (resolv_conf_path_old, resolv_conf_path))