[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using XML to handle all configuration files



>>>>> "Nicolás" == Nicolás Lichtmaier <nick@debian.org> writes:

    Nicolás>  The idea isn't to have two files. The XML version will
    Nicolás> probably never be written to the disk. It actss just an
    Nicolás> intermediate common data model.  And the XML file sould
    Nicolás> capture everything, including comments. Yes, the
    Nicolás> disadvantage would be that the system will reorganize
    Nicolás> comments a bit when the file is regenerated.. =)

Personally, I thought it would be better to have two configuration files:

1. user can edit XML file in such a way that changes will be preserved
across upgrades and reconfiguration with dpkg-reconfigure[1].  Scripts
that need to modify given settings can easily modify the settings
without accidently messing around with other parts of the file
(eg. comments).

2. long term goal: programs can start using the XML format directly
rather then have the intermediate step. This would enable to
programmer to focus on improving the program rather then questions
like "is my configuration file format really flexible enough to allow
me to add feature XYZ?" (I know I have had problems like this in the
past).

(before any attempt is made at 2 for *existing* programs, extensive
research should be taken in how to avoid losing changes to existing
files, eg. generate XML file from existing config file).

Lets see - here is what I would suggest (slight improvement from
previous example):

<config>
  <upstream>
  ...
  </upstream>
  <debian>
  ...
  </debian>
  <redhat>
  ...
  </redhat>
  <update>
    <xslt ...>
    <restart execute="/etc/init.d/daemon reload" uid="root">
  </update>
</config>

Where:

<debian/> contains information specific to Debian which upstream don't
consider there problem, eg. parameters required for daemons, etc.
Debian scripts could use this directly, I don't see any point
in using a non-XML file here. Of course, existing settings
need to be extracted from any existing files, but I imagine this
should be easy.

<redhat/> other distributions could also include distribution
specific stuff as required.

(perhaps these two could be merged into one - that is open
to discussion).

<update/> would be used by an intelligent config editor that
can restart and update files as required.

<upstream/> the interesting stuff, which would get converted to the
traditional config format.

(actually I code take this one step further, and make the file generic
so it will work on any computer, even if /etc is NFS shared, but lets
keep to the KISS principle for now).
-- 
Brian May <bam@debian.org>



Reply to: