summaryrefslogtreecommitdiffstats
path: root/src/lib/Server
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-10-19 18:22:16 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-10-19 18:22:16 +0000
commit3fde96dfbc84671873073d809430df8c6e4f9bc8 (patch)
tree7d24761b51d2912bf0da513a9bae90af83076318 /src/lib/Server
parent4cb51f4e230e21befdf7ede23cfbe2da9bc244bb (diff)
downloadbcfg2-3fde96dfbc84671873073d809430df8c6e4f9bc8.tar.gz
bcfg2-3fde96dfbc84671873073d809430df8c6e4f9bc8.tar.bz2
bcfg2-3fde96dfbc84671873073d809430df8c6e4f9bc8.zip
more code
2004/10/18 15:26:01-05:00 anl.gov!desai make fstab work properly 2004/10/18 15:20:54-05:00 anl.gov!desai (Logical change 1.100) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@452 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r--src/lib/Server/Generators/Chiba.py76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/lib/Server/Generators/Chiba.py b/src/lib/Server/Generators/Chiba.py
index e69de29bb..20e7333ac 100644
--- a/src/lib/Server/Generators/Chiba.py
+++ b/src/lib/Server/Generators/Chiba.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+
+from re import compile as regcompile
+from Bcfg2.Server.Generator import Generator, DirectoryBacked, SingleXMLFileBacked
+
+'''This module configures files in a Chiba City specific way'''
+__revision__ = '$Revision$'
+
+class ChibaConf(SingleXMLFileBacked):
+ '''This class encapsulates all information needed for all Chiba config ops'''
+ def Index(self):
+ pass
+
+class Chiba(Generator):
+ '''the Chiba generator builds the following files:
+ -> /etc/fstab
+ -> /etc/network/interfaces
+ -> /etc/dhcpd.conf
+ -> /tftpboot/<node>.lst'''
+
+ __name__ = 'Chiba'
+ __version__ = '$Id$'
+ __author__ = 'bcfg-dev@mcs.anl.gov'
+ __provides__ = {'ConfigFile':{}}
+
+ mayor = regcompile("\$MAYOR")
+
+ def __setup__(self):
+ self.repo = DirectoryBacked(self.data, self.core.fam)
+ self.__provides__['ConfigFile']['/etc/fstab'] = self.build_fstab
+
+ def build_fstab(self, entry, metadata):
+ '''build fstab for chiba nodes'''
+ node = metadata.hostname.split('.')[0]
+ if 'ccn' in node:
+ nodeclass = 'compute'
+ mayor = 'cct%sm.mcs.anl.gov' % ((int(node[3:]) / 32) + 1)
+ elif 'ccviz' in node:
+ nodeclass = 'compute'
+ mayor = 'cct10m.mcs.anl.gov'
+ elif 'ccsto' in node:
+ nodeclass = 'storage'
+ mayor = 'cct9m.mcs.anl.gov'
+ elif 'cct' in node:
+ nodeclass = 'mayor'
+ mayor = 'ccprez.mcs.anl.gov'
+ elif 'ccfs' in node:
+ nodeclass = 'fs'
+ mayor = 'ccprez.mcs.anl.gov'
+ else:
+ raise KeyError, node
+
+ entry.attrib['owner'] = 'root'
+ entry.attrib['group'] = 'root'
+ entry.attrib['perms'] = '0644'
+ fsdata = self.repo.entries["fstab_%s" % (nodeclass)]
+ entry.text = self.mayor.sub(mayor, fsdata)
+
+ def build_interfaces(self, entry, metadata):
+ '''build network configs for clients'''
+ entry.attrib['owner'] = 'root'
+ entry.attrib['group'] = 'root'
+ entry.attrib['perms'] = '0644'
+ entry.text = self.repo.entries['iface-template']
+ # add more here later
+
+ def build_dhcpd(self, entry, metadata):
+ '''build dhcpd.conf for server(s)'''
+ pass
+
+ def build_tftp(self, entry, metadata):
+ '''build tftp files for client netboot'''
+ data = self.repo.entries['tftp-template']
+
+
+