Browse code

installer : check if /etc/resolv.conf exists before copying, remove unused import.

Change-Id: Iff87c0f9a6d84713a5957fa6fde56894df868176
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/3973
Reviewed-by: Bo Gan <ganb@vmware.com>
Tested-by: gerrit-photon <photon-checkins@vmware.com>

xiaolin-vmware authored on 2017/10/06 06:37:54
Showing 4 changed files
... ...
@@ -5,12 +5,7 @@
5 5
 import subprocess
6 6
 import curses
7 7
 import os
8
-import crypt
9
-import re
10
-import random
11
-import string
12 8
 import shutil
13
-import fnmatch
14 9
 import signal
15 10
 import sys
16 11
 import glob
... ...
@@ -173,7 +168,8 @@ class Installer(object):
173 173
         if self.iso_installer:
174 174
             self.progress_bar.show_loading('Finalizing installation')
175 175
 
176
-        shutil.copy("/etc/resolv.conf", self.photon_root + '/etc/.')
176
+        if os.path.exists("/etc/resolv.conf"):
177
+            shutil.copy("/etc/resolv.conf", self.photon_root + '/etc/.')
177 178
         self.finalize_system()
178 179
 
179 180
         if not self.install_config['iso_system']:
... ...
@@ -3,9 +3,7 @@
3 3
 #
4 4
 #    Author: Mahmoud Bassiouny <mbassiouny@vmware.com>
5 5
 
6
-import json
7 6
 import os
8
-import curses
9 7
 from jsonwrapper import JsonWrapper
10 8
 from menu import Menu
11 9
 from window import Window
... ...
@@ -14,7 +14,6 @@ import sys
14 14
 import os
15 15
 from jsonwrapper import JsonWrapper
16 16
 from packageselector import PackageSelector
17
-import json
18 17
 
19 18
 def query_yes_no(question, default="no"):
20 19
     valid = {"yes": True, "y": True, "ye": True,
... ...
@@ -1,5 +1,3 @@
1
-#! /usr/bin/python2
2
-#
3 1
 #    Copyright (C) 2015 vmware inc.
4 2
 #
5 3
 #    Author: Mahmoud Bassiouny <mbassiouny@vmware.com>