X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2Fsteps%2FGetAndUpdateNodeDetails.py;h=950466b6652cc71a89aea6d4dec6712cf7df0ee9;hb=4eea76a0545774fae808b29d94227be100872bf7;hp=8e48c39a98f390834f719b3271c8c33bcbd2652e;hpb=d027bde0cf139ab8e480f0b80cfc9b67214f342d;p=bootmanager.git diff --git a/source/steps/GetAndUpdateNodeDetails.py b/source/steps/GetAndUpdateNodeDetails.py index 8e48c39..950466b 100644 --- a/source/steps/GetAndUpdateNodeDetails.py +++ b/source/steps/GetAndUpdateNodeDetails.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python # Copyright (c) 2003 Intel Corporation # All rights reserved. @@ -23,22 +23,21 @@ def Run( vars, log ): broadcast, netmask, dns1/2, and the hostname/domainname. Expect the following keys to be set: - BOOT_CD_VERSION A tuple of the current bootcd version SKIP_HARDWARE_REQUIREMENT_CHECK Whether or not we should skip hardware requirement checks The following keys are set/updated: - WAS_NODE_ID_IN_CONF Set to 1 if the node id was in the conf file - WAS_NODE_KEY_IN_CONF Set to 1 if the node key was in the conf file - BOOT_STATE The current node boot state - NODE_MODEL The user specified model of this node - NODE_MODEL_OPTIONS The options extracted from the user specified - model of this node - NETWORK_SETTINGS A dictionary of the values of the network settings + WAS_NODE_ID_IN_CONF Set to 1 if the node id was in the conf file + WAS_NODE_KEY_IN_CONF Set to 1 if the node key was in the conf file + BOOT_STATE The current node boot state + NODE_MODEL The user specified model of this node + NODE_MODEL_OPTIONS The options extracted from the user specified + model of this node SKIP_HARDWARE_REQUIREMENT_CHECK Whether or not we should skip hardware - requirement checks - NODE_SESSION The session value returned from BootGetNodeDetails - NODE_NETWORKS The networks associated with this node + requirement checks + NODE_SESSION The session value returned from BootGetNodeDetails + INTERFACES The network interfaces associated with this node + INTERFACE_SETTINGS A dictionary of the values of the interface settings Return 1 if able to contact PLC and get node info. Raise a BootManagerException if anything fails. @@ -48,17 +47,13 @@ def Run( vars, log ): # make sure we have the variables we need try: - BOOT_CD_VERSION= vars["BOOT_CD_VERSION"] - if BOOT_CD_VERSION == "": - raise ValueError, "BOOT_CD_VERSION" - SKIP_HARDWARE_REQUIREMENT_CHECK= vars["SKIP_HARDWARE_REQUIREMENT_CHECK"] if SKIP_HARDWARE_REQUIREMENT_CHECK == "": raise ValueError, "SKIP_HARDWARE_REQUIREMENT_CHECK" - NETWORK_SETTINGS= vars["NETWORK_SETTINGS"] - if NETWORK_SETTINGS == "": - raise ValueError, "NETWORK_SETTINGS" + INTERFACE_SETTINGS= vars["INTERFACE_SETTINGS"] + if INTERFACE_SETTINGS == "": + raise ValueError, "INTERFACE_SETTINGS" WAS_NODE_ID_IN_CONF= vars["WAS_NODE_ID_IN_CONF"] if WAS_NODE_ID_IN_CONF == "": @@ -73,11 +68,14 @@ def Run( vars, log ): except ValueError, var: raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var - details= BootAPI.call_api_function( vars, "GetNodes", (vars['NODE_ID'], ['boot_state', 'nodegroup_ids', 'interface_ids', 'model', 'site_id']))[0] + node_details= BootAPI.call_api_function( vars, "GetNodes", + (vars['NODE_ID'], + ['boot_state', 'nodegroup_ids', 'interface_ids', 'model', 'site_id']))[0] - vars['BOOT_STATE']= details['boot_state'] - vars['NODE_MODEL']= string.strip(details['model']) - vars['SITE_ID'] = details['site_id'] + vars['BOOT_STATE']= node_details['boot_state'] + vars['RUN_LEVEL']= node_details['boot_state'] + vars['NODE_MODEL']= string.strip(node_details['model']) + vars['SITE_ID'] = node_details['site_id'] log.write( "Successfully retrieved node record.\n" ) log.write( "Current boot state: %s\n" % vars['BOOT_STATE'] ) log.write( "Node make/model: %s\n" % vars['NODE_MODEL'] ) @@ -94,9 +92,9 @@ def Run( vars, log ): # this contains all the node networks, for now, we are only concerned # in the primary network - node_networks= BootAPI.call_api_function( vars, "GetInterfaces", (details['interface_ids'],)) + interfaces= BootAPI.call_api_function( vars, "GetInterfaces", (node_details['interface_ids'],)) got_primary= 0 - for network in node_networks: + for network in interfaces: if network['is_primary'] == 1: log.write( "Primary network as returned from PLC: %s\n" % str(network) ) got_primary= 1 @@ -105,6 +103,6 @@ def Run( vars, log ): if not got_primary: raise BootManagerException, "Node did not have a primary network." - vars['NODE_NETWORKS']= node_networks + vars['INTERFACES']= interfaces return 1