Code review comment for lp:~jtv/maas/pkg-bug-1086239

Revision history for this message
Gavin Panella (allenap) wrote :

Shell, and the tools typically available therein (i.e. sed, awk,
etc.), is a difficult environment in which to edit config files. Shell
- and I'm mainly thinking of /bin/sh and its descendants - is
wonderful for joining processes together, but beyond that it gets into
quick and dirty territory. Which can be exactly what we need for
interactive use. However, the scripting capabilities are well into the
toxic sludge end of dirty.

I've been thinking about this problem a bit.

Bazaar uses configobj to manage its configuration files, which allows
Bazaar to edit config files (in Python, not shell) without losing
comments and formatting. This would be quite neat, but I'm not sure
it's a low enough common denominator; we still have shell scripts in
MAAS that need to ingest something as stupid as they are, and the .ini
style files that configobj works with are just too structured.

I can't remember all of my thought processes, but I think the best way
to do this such that shell scripts can work with config (and are less
likely to fuck it up) is to store one shared configuration value per
file. This means that the cluster UUID should go in, say:

  /etc/maas/cluster/uuid

The contents of this file should be the UUID and nothing else.

I think this approach would work better with shell scripts that need
to share configration with other tools, and with packaging. It would
give us the freedom to move away from these awful packaging hacks
which, apart from being less readable than obfuscated Perl, are also
untested and difficult to test.

« Back to merge proposal