-#!/usr/bin/python2 -u
-
+#!/usr/bin/python
+#
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
#
update_files= 1
+ # Thierry - 2012/03 - I'm renaming vserver-reference into sliceimage
+ # however I can't quite grasp the reason for this test below, very likely
+ # compatibility with very old node images or something
if '/.vref/' in vserver_dir or \
'/.vcache/' in vserver_dir or \
'/vserver-reference' in vserver_dir:
if update_files:
log.write( "Updating network files in %s.\n" % vserver_dir )
+ try:
+ # NOTE: this works around a recurring problem on public pl,
+ # suspected to be due to mismatch between 2.6.12 bootcd and
+ # 2.6.22/f8 root environment. files randomly show up with the
+ # immutible attribute set. this clears it before trying to write
+ # the files below.
+ utils.sysexec( "chattr -i %s/etc/hosts" % vserver_dir , log )
+ utils.sysexec( "chattr -i %s/etc/resolv.conf" % vserver_dir , log )
+ except:
+ pass
+
file_path= "%s/etc/hosts" % vserver_dir
hosts_file= file(file_path, "w" )
hosts_file.write( "127.0.0.1 localhost\n" )
if method == "static":
hosts_file.write( "%s %s.%s\n" % (ip, hostname, domainname) )
- hosts_file.close()
- hosts_file= None
-
+ hosts_file.close()
+ hosts_file= None
file_path= "%s/etc/resolv.conf" % vserver_dir
if method == "dhcp":