skip set hosts by mic when /etc/hosts exists or add option to skip 97/220497/1
authoryan11.meng <yan11.meng@samsung.com>
Thu, 19 Dec 2019 02:23:08 +0000 (10:23 +0800)
committeryan11.meng <yan11.meng@samsung.com>
Thu, 19 Dec 2019 02:23:08 +0000 (10:23 +0800)
Change-Id: Ic9c63103fdde12ead58fbef676952a575e97daed

mic/kickstart/__init__.py

index 0c3959e..6fbf3ed 100755 (executable)
@@ -674,7 +674,8 @@ class NetworkConfig(KickstartConfig):
 
         #to avoid import error because of import each other
         from mic.conf import configmgr
-        if configmgr.create['skip_set_hosts'] == False:
+        path=self.path("/etc/hosts")
+        if configmgr.create['skip_set_hosts'] == False and os.path.exists(path) == False:
             self.write_hosts(hostname)
         self.write_resolv(nodns, nameservers)