[Openstack-devel] Rewriting the .ini parsing bit of openstack-pkg-tools

James Page james.page at ubuntu.com
Tue Mar 19 09:07:12 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Thomas

On 11/03/13 07:55, Thomas Goirand wrote:
> When Roland was doing some packaging work, we had discussions on
> how to do the parsing of .ini files inside Openstack. I first wrote
> a very ugly shell script function, which was about 150 lines, which
> is completely lame, for such a small task. Then he decided
> (rightly) that it was crap, and tried rewriting it in python. The
> current code in openstack-pkg-tools is from him, and is like this:
[...]

I took a look through the use of debconf in glance just to get a feel
of how it currently works for the openstack packages in Debian (for
reference we don't use debconf at all in the Ubuntu packages).

I'm uncomfortable about how the maintainer scripts directly manipulate
the configuration files installed by the packages, for example:

         sed -i "s,^flavor\s*=.*$,flavor = $FLAVOR,"
/etc/glance/glance-registry.conf
            FLAVOR=keystone
            db_get glance/auth-url
            sed -i "s,^auth_uri\s*=\s*.\+$,auth_uri = $RET,"
/etc/glance/glance-registry-paste.ini
            db_get glance/auth-token
            sed -i "s/^admin_token\s*=\s*.\+$/admin_token = $RET/"
/etc/glance/glance-registry-paste.ini

If the end user has elected to use debconf to configure packages, then
this is OK; however debconf is just one way to manage configuration -
puppet, chef, juju or whatever configuration management tool of choice
might be in use will also manipulate these files.

With the direct manipulation that the package does, there is potential
for the packaging to stamp all over local changes to configuration
files; the debconf managed files should be installed and managed using
ucf so user changes are always preserved (at least that is the way
I've always used dbconfig-common and debconf).

How about you take a completely different approach to this issue;
rather than parsing/modifying the upstream provided configuration
files, make templates as part of the packaging with suitable
replacement tokens (easy to sed), populate using debconf and install
using ucf.  The downside of this of course is that you have to manage
your own versions of configuration files; but this might be a suitable
compromise.

Anyway - that's probably how I would approach this issue.

HTH

James

- -- 
James Page
Ubuntu Core Developer
Debian Maintainer
james.page at ubuntu.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBCAAGBQJRSCrAAAoJEL/srsug59jDeNAQAITAMxzE7bR2oC59kGYhiAcu
ad510p9223ZRie7eiD8GwhxIF1yWeHFggzaO55psgRaW+gOUMMs2py6Plaju1D/l
a/lb7n3frG0+c52yvkgVg5ChLeq6faVCpFGLpHj8ryOxGOeYL2iLSBzO8ibCKc/t
G+rPnsGCph0B9p/l6xhI/+owZs8lcA+T8Ttrqnmd39bfr0+OXh9PDFGAtUf1fJAY
LcUzkJTjf79Mxhory2OHmkZ9pVMTARW06Xwbl1jw5dbtsOFosRiKvhXjjNJqYBDH
ktfHUA1C/CSL3ZyE2wl9ht/TtrEapKdJ2SzNtBvAhCwmNPvZzMdpfIsn479b0Str
pndBla/ZeQKahKoS0rDTu18ezOnRi/YVsBBWpnO5XctMgDtRXYlI5JEN+wOoyG4J
OOC4L3/Qz2lD7DltRNKcVO/bjryHy/Mf38uSqJOSOBUfXtAJPNB0n6L6+SlRW2WC
B6eYzqsynDQc4YU6P4FoZCA+eFksa79X+fn+TIT4bQAV6XWudgzlY/5J+KGXefBa
2KPy+p2GDhZsOzKQPPHZdfza8xFon5qPYqY/REMPnqIAuGzwK48ykL4cMKkrxzoL
wQewmPW6Wof0AFhVQ/mXvixjNGfeHrT+JQkU3JNhpDSGu5IDCX6UcZ6xBO0L8v9T
3nc90j7jBivuiGRWrEP3
=e0Yy
-----END PGP SIGNATURE-----



More information about the Openstack-devel mailing list