# $Id$
+# $URL$
import random
import base64
import os
from PLC.Nodes import Node, Nodes
from PLC.Interfaces import Interface, Interfaces
from PLC.InterfaceTags import InterfaceTag, InterfaceTags
+from PLC.NodeTags import NodeTag, NodeTags
# could not define this in the class..
# create a dict with the allowed actions for each type of node
This method is a redesign based on former, supposedly dedicated,
AdmGenerateNodeConfFile
- As compared with its ancestor, this method provides a much more detailed
+ As compared with its ancestor, this method provides a much more
detailed interface, that allows to
(*) either just preview the node config file -- in which case
the node key is NOT recomputed, and NOT provided in the output
Options: an optional array of keywords.
options are not supported for generic images
options are not supported for dummynet boxes
- Currently supported are
+ Currently supported are
- 'partition' - for USB actions only
- 'cramfs'
- 'serial' or 'serial:<console_spec>'
passed to build.sh as -V <variant>
variants are used to run a different kernel on the bootCD
see kvariant.sh for how to create a variant
- - 'no-hangcheck'
+ - 'no-hangcheck' - disable hangcheck
+ Tags: the following tags are taken into account when attached to the node:
+ 'serial', 'cramfs', 'kvariant', 'kargs', 'no-hangcheck'
+
Security:
- Non-admins can only generate files for nodes at their sites.
- Non-admins, when they provide a filename, *must* specify it in the %d area
if category_settings:
file += '### Category : %s\n'%category
for setting in category_settings:
- file += '%s_%s="%s"\n'%(category.upper(),setting['name'].upper(),setting['value'])
+ file += '%s_%s="%s"\n'%(category.upper(),setting['tagname'].upper(),setting['value'])
for interface in interfaces:
if interface['method'] == 'ipmi':
else:
# create a dict for build.sh
build_sh_spec={'kargs':[]}
+ # use node tags as defaults
+ # check for node tag equivalents
+ tags = NodeTags(self.api,
+ {'node_id': node['node_id'],
+ 'tagname': ['serial', 'cramfs', 'kvariant', 'kargs', 'no-hangcheck']},
+ ['tagname', 'value'])
+ if tags:
+ for tag in tags:
+ if tag['tagname'] == 'serial':
+ build_sh_spec['serial'] = tag['value']
+ if tag['tagname'] == 'cramfs':
+ build_sh_spec['cramfs'] = True
+ if tag['tagname'] == 'kvariant':
+ build_sh_spec['variant'] = tag['value']
+ if tag['tagname'] == 'kargs':
+ build_sh_spec['kargs'].append(tag['value'].split())
+ if tag['tagname'] == 'no-hangcheck':
+ build_sh_spec['kargs'].append('hcheck_reboot0')
+ # then options can override tags
for option in options:
if option == "cramfs":
build_sh_spec['cramfs']=True