On 01/18/2010 10:24 AM, Glenn Bailey wrote:
> At first I thought I could maintain a separate snippet to define the options
> for each location, but I do a full sync off of my master server would
> overwrite the said file. I want to try and keep from touching the kickstart
> on each server anytime I do an update on the master server. Perhaps something
> in cheetah_macros? This file is blank so I don't have an example to use here,
> or even knowledge of what is capable with it.
I see you've already come up with another solution, but I solve this issue here
with snippets. Below is my snippet for setting the time zone. I'm not a
python
programmer and still get confused by Cheetah, so the regex logic is actually
stolen from another standard Cobbler snippet I think. I pretty much just built
the array and added some ifs.
In my case, we have standardized host names with a site code being the first 3
characters, which I simply evaluate to determine where in the world it is.
Although this snippet actually looks at the Cobbler system name so non-standard
names can still be accommodated by prefixing the system name and leaving the
configured host name correct. My system names typically match my host names.
I
don't yet do any synchronization between my Cobbler servers, but this snippet
could be used on any of them as is. And since I don't intend to put Cobbler
servers at all these sites, it's very likely I would need to build a system
destined for a time zone other than the Cobbler server's local time zone.
#import re
#if $getVar("system_name","") != ""
#set $system = $getVar('system_name')
#set $TimeZone = {}
#set $TimeZone['aus'] = 'America/Chicago'
#set $TimeZone['bat'] = 'Asia/Manila'
#set $TimeZone['bgl'] = 'Asia/Kolkata'
#set $TimeZone['cav'] = 'Asia/Manila'
#set $TimeZone['cat'] = 'Europe/Rome'
#set $TimeZone['chb'] = 'Asia/Bangkok'
#set $TimeZone['chd'] = 'America/Phoenix'
#set $TimeZone['chm'] = 'America/New_York'
#set $TimeZone['cos'] = 'America/Denver'
#set $TimeZone['cpn'] = 'America/Chicago'
#set $TimeZone['cri'] = 'America/New_York'
#set $TimeZone['dal'] = 'America/Chicago'
#set $TimeZone['dlf'] = 'Europe/Amsterdam'
#set $TimeZone['drs'] = 'Europe/Berlin'
#set $TimeZone['ftc'] = 'America/Denver'
#set $TimeZone['gdh'] = 'Asia/Kolkata'
#set $TimeZone['grn'] = 'Europe/Paris'
#set $TimeZone['hlb'] = 'America/Los_Angeles'
#set $TimeZone['hrt'] = 'America/Chicago'
#set $TimeZone['irv'] = 'America/Los_Angeles'
#set $TimeZone['ist'] = 'Asia/Istanbul'
#set $TimeZone['kws'] = 'Asia/Toyko'
#set $TimeZone['lac'] = 'Europe/Paris'
#set $TimeZone['lee'] = 'America/New_York'
#set $TimeZone['mbf'] = 'America/New_York'
#set $TimeZone['mfn'] = 'America/Los_Angeles'
#set $TimeZone['nwb'] = 'Europe/London'
#set $TimeZone['pav'] = 'Europe/Rome'
#set $TimeZone['rlh'] = 'America/New_York'
#set $TimeZone['roz'] = 'Europe/Rome'
#set $TimeZone['shg'] = 'Asia/Shanghai'
#set $TimeZone['sjc'] = 'America/Los_Angeles'
#set $TimeZone['ssk'] = 'Asia/Seoul'
#set $TimeZone['svl'] = 'America/Los_Angeles'
#set $TimeZone['tai'] = 'Asia/Taipei'
#set $TimeZone['ups'] = 'Europe/Vienna'
#set $TimeZone['wst'] = 'America/Indiana/Indianapolis'
#set $site = re.match('^.{3}', $system.lower()).group()
#if $site in $TimeZone
# Site: $site
#set $localTZ = $TimeZone[$site]
timezone --utc $localTZ
#else
# Site: Can't match $site
timezone --utc
#end if
#else
# Site Unknown
timezone --utc
#end if
--
/* Wes Hardin */
_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler