Re: beginner questions

Aahz <[email protected]> Thu, 18 Mar 2010 14:38:55 -0700
Newsgroups gmane.comp.python.cheetah
Organization The Cat & Dragon
Message-ID <[email protected]>
On Thu, Mar 18, 2010, Jonathan Sabo wrote:
>
> I'm using cheetah templates in Cobbler and I'm just getting started
> with cheetah itself so please forgive my lame and hopefully not to
> annoying questions.  Cobbler comes with a dhcpd.conf template and I've
> customized it a bit but I'm not sure there isn't a cleaner way to
> write this code.  I want to allow non programmer types to add
> netblocks to this file so it can configure the dhcpd.conf file.  I'm
> curious if there are cleaner ways to write this or if this just looks
> retarded?
> 
> #set $netblocks = {
> 'NYC' : {
> 'NYC_MANAGEMENT'               : { 'NETWORK' : '10.37.40.0',
> 'NETMASK' : '255.255.248.0', 'GATEWAY' : '10.37.40.1' },
> 'NYC_DMZ_MANAGEMENT'      : { 'NETWORK' : '10.37.54.0',  'NETMASK' :
> '255.255.255.0', 'GATEWAY' : '10.37.54.1' },
> 'NYC_EXT_MANAGEMENT'       : { 'NETWORK' : '10.37.72.0',  'NETMASK' :
> '255.255.248.0', 'GATEWAY' : '10.37.72.1' },
> 'TRUSTED_MANAGEMENT'       : { 'NETWORK' : '10.37.86.0',  'NETMASK' :
> '255.255.255.0', 'GATEWAY' : '10.37.86.1' },
> 'UNTRUSTED_MANAGEMENT'  : { 'NETWORK' : '10.37.200.0', 'NETMASK' :
> '255.255.248.0', 'GATEWAY' : '10.37.200.1' },
> 'DMZ_MANAGEMENT'  : { 'NETWORK' : '10.37.214.0', 'NETMASK' :
> '255.255.255.0', 'GATEWAY' : '10.37.214.1' },
> }
> }

For real non-programmers, I'd probably try to come up with a separate
text file rather than having them modify the template directly.  But
presumably the non-programmers who understand netmask and gateway are
somewhat technical.
-- 
Aahz ([email protected])           <*>         http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev