Browse code

Adding entries in /etc/hosts

Change-Id: I887556c70893c83ed32b5b72a01883712cc6c795
Reviewed-on: http://photon-jenkins.eng.vmware.com/782
Reviewed-by: Xiaolin Li <xiaolinl@vmware.com>
Tested-by: jenkins-photon <wangnan2015@hotmail.com>

mbassiouny authored on 2016/04/30 07:07:55
Showing 2 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Default file system
2 2
 Name:		filesystem
3 3
 Version:	1.0
4
-Release:	3%{?dist}
4
+Release:	4%{?dist}
5 5
 License:	GPLv3
6 6
 Group:		System Environment/Base
7 7
 Vendor:		VMware, Inc.
... ...
@@ -161,7 +161,9 @@ EOF
161 161
 cat > %{buildroot}/etc/hosts <<- "EOF"
162 162
 # Begin /etc/hosts (network card version)
163 163
 
164
-127.0.0.1	localhost
164
+::1         localhost ipv6-localhost ipv6-loopback
165
+127.0.0.1   localhost.localdomain
166
+127.0.0.1   localhost
165 167
 
166 168
 # End /etc/hosts (network card version)
167 169
 EOF
... ...
@@ -533,6 +535,8 @@ EOF
533 533
 /usr/local/lib64
534 534
 %endif
535 535
 %changelog
536
+*   Fri Apr 29 2016 Mahmoud Bassiouny <mbassiouny@vmware.com> 1.0-4
537
+-   Updating the /etc/hosts file
536 538
 *   Fri Apr 22 2016 Divya Thaluru <dthaluru@vmware.com> 1.0-3
537 539
 -   Setting default umask value to 027
538 540
 *   Thu Apr 21 2016 Anish Swaminathan <anishs@vmware.com> 1.0-2
... ...
@@ -16,4 +16,4 @@ def execute(name, ks_config, config, root):
16 16
     with open(hostname_file,  'wb') as outfile:
17 17
     	outfile.write(hostname)
18 18
 
19
-    commons.replace_string_in_file(hosts_file, r'127\.0\.0\.1\s+localhost', '127.0.0.1\tlocalhost\n127.0.0.1\t' + hostname)
19
+    commons.replace_string_in_file(hosts_file, r'127\.0\.0\.1\s+localhost\s*\Z', '127.0.0.1\tlocalhost\n127.0.0.1\t' + hostname)