From fe8cdb71744b389dcb3b5370200f0a452ec73bce Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Wed, 7 Jan 2004 15:38:50 +0000 Subject: (Logical change 1.14) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@53 ce84e21b-d406-0410-9b95-82705330c041 --- generators/fstab.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'generators') diff --git a/generators/fstab.py b/generators/fstab.py index e69de29bb..039febc30 100644 --- a/generators/fstab.py +++ b/generators/fstab.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +from re import compile + +from Generator import Generator +from GeneratorUtils import DirectoryBacked +from Types import ConfigFile + +class fstab(Generator): + __name__ = 'fstab' + __version__ = '$Id$' + __author__ = 'bcfg-dev@mcs.anl.gov' + __build__ = {'/etc/fstab':'build_fstab'} + + mayor = compile("\$MAYOR") + + def __setup__(self): + self.repo = DirectoryBacked(self.data) + + def build_fstab(self,name,client): + node = client.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,client + + fsname = "fstab_%s"%(nodeclass) + fsdata = self.repo.entries[fsname].data + + return ConfigFile('/etc/fstab','root','root','0644',self.mayor.sub(mayor,fsdata)) + + -- cgit v1.2.3-1-g7c22