#!/usr/bin/python
-
+#
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
#
and read, return 1.
Expect the following variables from the store:
- SUPPORT_FILE_DIR directory on the boot servers containing
- scripts and support files
Sets the following variables from the configuration file:
WAS_NODE_ID_IN_CONF Set to 1 if the node id was in the conf file
# make sure we have the variables we need
- try:
- SUPPORT_FILE_DIR= vars["SUPPORT_FILE_DIR"]
- if SUPPORT_FILE_DIR == None:
- raise ValueError, "SUPPORT_FILE_DIR"
-
- except KeyError, var:
- raise BootManagerException, "Missing variable in vars: %s\n" % var
- except ValueError, var:
- raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
-
INTERFACE_SETTINGS= {}
INTERFACE_SETTINGS['method']= "dhcp"
conf_file_path= "%s/%s" % (mount_point,NEW_CONF_FILE_NAME)
- log.write( "Checking for existence of %s\n" % conf_file_path )
+# log.write( "Checking for existence of %s\n" % conf_file_path )
if os.access( conf_file_path, os.R_OK ):
try:
conf_file= file(conf_file_path,"r")
utils.sysexec_noerr( "umount %s" % mount_point, log )
if __parse_configuration_file( vars, log, conf_file_contents):
+ log.write("ReadNodeConfiguration: [1] using %s from floppy /dev/fd0\n"%NEW_CONF_FILE_NAME)
return 1
else:
raise BootManagerException( "Found configuration file plnode.txt " \
# try to parse it later...
conf_file_path= "%s/%s" % (mount_point,OLD_CONF_FILE_NAME)
- log.write( "Checking for existence of %s (used later)\n" % conf_file_path )
+# this message really does not convey any useful information
+# log.write( "Checking for existence of %s (used later)\n" % conf_file_path )
if os.access( conf_file_path, os.R_OK ):
try:
old_conf_file= file(conf_file_path,"r")
log.write( "Read in contents of file %s\n" % \
conf_file_path )
- if __parse_configuration_file( vars, log, \
- conf_file_contents):
+ if __parse_configuration_file( vars, log, conf_file_contents):
parsed_file= 1
except IOError, e:
log.write( "Unable to read file %s\n" % conf_file_path )
utils.sysexec_noerr( "umount %s" % mount_point, log )
if found_file:
if parsed_file:
+ log.write("ReadNodeConfiguration: [2] using %s from partition %s\n"%\
+ (NEW_CONF_FILE_NAME,full_device))
return 1
else:
raise BootManagerException( \
- "Found configuration file plnode.txt " \
- "on floppy, but was unable to parse it.")
+ "Found configuration file on %s, but was unable to parse it."%full_device)
# 3. check standard floppy disk for old file name planet.cnf
- log.write( "Checking standard floppy disk for planet.cnf file " \
- "(for legacy nodes).\n" )
+ log.write( "Checking standard floppy disk for planet.cnf file (for legacy nodes).\n" )
if old_conf_file_contents:
if __parse_configuration_file( vars, log, old_conf_file_contents):
+ log.write("ReadNodeConfiguration: [3] using %s from floppy /dev/fd0\n"%OLD_CONF_FILE_NAME)
return 1
else:
raise BootManagerException( "Found configuration file planet.cnf " \
pass
if __parse_configuration_file( vars, log, conf_file_contents):
+ log.write("ReadNodeConfiguration: [4] using %s from ramdisk\n"%NEW_CONF_FILE_NAME)
return 1
else:
raise BootManagerException( "Found configuration file plnode.txt " \
pass
if __parse_configuration_file( vars, log, conf_file_contents):
+ log.write("ReadNodeConfiguration: [5] using %s from CD in /usr/boot\n"%NEW_CONF_FILE_NAME)
return 1
else:
raise BootManagerException( "Found configuration file plnode.txt " \
pass
if __parse_configuration_file( vars, log, conf_file_contents):
+ log.write("ReadNodeConfiguration: [6] using %s from /usr\n"%NEW_CONF_FILE_NAME)
return 1
else:
raise BootManagerException( "Found configuration file plnode.txt " \
of the configuration file is completed.
"""
- SUPPORT_FILE_DIR= vars["SUPPORT_FILE_DIR"]
INTERFACE_SETTINGS= vars["INTERFACE_SETTINGS"]
if file_contents is None:
bs_request= BootServerRequest.BootServerRequest(vars)
postVars= {"mac_addr" : INTERFACE_SETTINGS["mac"]}
- result= bs_request.DownloadFile( "%s/getnodeid.php" %
- SUPPORT_FILE_DIR,
+ result= bs_request.DownloadFile( "/boot/getnodeid.php",
None, postVars, 1, 1,
"/tmp/node_id")
if result == 0:
vars["INTERFACE_SETTINGS"]= INTERFACE_SETTINGS
- if not hostname_resolve_ok and not vars['DISCONNECTED_OPERATION']:
+ if (not hostname_resolve_ok and not vars['DISCONNECTED_OPERATION'] and
+ 'NAT_MODE' not in vars):
log.write( "Hostname does not resolve correctly, will not continue.\n" )
if can_make_api_call:
raise BootManagerException, \
"Configured node hostname does not resolve."
+ try:
+ log.write("Using NODE_ID %d\n"%vars['NODE_ID'])
+ except:
+ log.write("Unknown NODE_ID")
+
return 1