Using mercurial for configuration files version control
Harvey Chapman
hchapman-hg at 3gfp.com
Mon Nov 29 19:46:04 UTC 2010
On Nov 25, 2010, at 9:42 AM, Vadym Chepkov wrote:
> On Nov 25, 2010, at 9:20 AM, FELD Boris wrote:
>>
>> The solution is quite simple, you just track a template version of your configuration file.
>> In your case, the template version could be very short :
>> ...
>> You named this file /etc/rc.conf.tpl and track this file into mercurial. Then for each node, you create a local file based on this template file.
>
> I was hoping to avoid having to maintain additional templates/parsers/hooks
We have a similar setup for deploying servers. However, we embed keywords in our template files and then run a script which replaces the keywords. The script also tells you if you make changes to the local files without applying them to the templates. This prevents accidental overwrites and forgetting to commit changes. This works for us because we probably change 15 lines (per machine) out of 1000 lines inside our config files.
Example template:
hostname=OUR_UNIQUE_PREFIX_HOSTNAME
snmp_enabled=OUR_UNIQUE_PREFIX_SNMP_ENABLED
something_else=false
Example template_config:
OUR_UNIQUE_PREFIX_HOSTNAME=foo
OUR_UNIQUE_PREFIX_SNMP_ENABLED=true
We also have a default set of config values in case one is not defined in the user's local file. To recap, we track the template files, a default config file, and the script that builds the real config files from the templates. We do not track the built files or the template_config file.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20101129/d4df21a2/attachment.html>
More information about the Mercurial
mailing list