Support config.d directory

Bug #1373467 reported by James Hunt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu system image
Fix Released
High
Barry Warsaw

Bug Description

Currently, the system-image package requires system-image-common. The latter provides /etc/system-image/client.ini which is configurated for a Touch environment.

However, to allow system-image to be used on systems other than Touch, it would be useful to have the ability to specify an alternate client.ini. Maybe splitting client.ini out of system-image-common into its own package which could provide

   /etc/system-image/client.conf.d/touch.conf

or similar?

Tags: client

Related branches

Barry Warsaw (barry)
no longer affects: system-image (Ubuntu)
tags: added: client
Changed in ubuntu-system-image:
status: New → Triaged
Barry Warsaw (barry)
Changed in ubuntu-system-image:
milestone: none → 2.5
Barry Warsaw (barry)
Changed in ubuntu-system-image:
importance: Undecided → High
assignee: nobody → Barry Warsaw (barry)
Barry Warsaw (barry)
Changed in ubuntu-system-image:
milestone: 2.5 → 3.0
Revision history for this message
Barry Warsaw (barry) wrote :

Here's some thinking on the idea. Rather than completely obsolete client.ini and channel.ini, I'm thinking about the following rules:

1) /etc/system-image/client.ini is loaded first if it exists

2) /etc/system-image/config.d/ is scanned for files ending in .ini or .cfg, and sorted alphanumerically by file name

3) the matching, sorted config.d/ files are loaded, and can override anything in client.ini

4) /etc/system-image/channel.ini is loaded, which currently allows overriding only the [service] section.

Now, questions:

* Should we retain /etc/system-image/client.ini or just move all ini files to config.d? If we move it, it should probably be named /etc/system-image/config.d/00_default.ini.

* Should we keep the --config/-C option? Right now it names an alternative client.ini file and this is used by the test suite among other use cases. Maybe we should just change this so that it names the config.d/ directory.

* If we keep the default client.ini location, should we allow it to specify where it's config.d/ directory is?

* Should we keep channel.ini? We could theoretically just move it to config.d/ and name it something like 01_channel.ini.

* Should we lift the override restriction on channel.ini and just treat that file the same as all the others, i.e. allowing it to override any setting in any section? This will require coordination with image builds since channel.ini is generated by that process. If we move it we might need a transition period.

* Is alphanumeric sorting good enough? An alternative is to require a regexp like (?P<order>\d+)_[.*].(cfg|ini) and sort only on the int() conversion of 'order'.

I'm pretty sure I can do the simple cases with just the stdlib configparser. Another implementation choice might be lazr.config, which has some very nice properties, but isn't even in main, and I'm reluctant to do a MIR for it unless it's really necessary. (Side note, I've been thinking about pulling some of the nicer features of lazr.config into the stdlib for Python 3.5.)

I may have more questions once I start to implement this. I'm really tempted to replace client.ini and channel.ini and lift the override restrictions.

Changed in ubuntu-system-image:
status: Triaged → In Progress
Barry Warsaw (barry)
summary: - Ability to specify alternate client.ini
+ Support config.d directory
Revision history for this message
Barry Warsaw (barry) wrote :

I ran into a snag. The API provides for a "last update date" which is currently calculated from mtime of the first of these files:

* /userdata/.last_update
* /etc/system-image/channel.ini
* /etc/ubuntu-build

Of course, if we get rid of the last two, then only the first is relevant, but that file does not exist in the normal test suite. I'm not sure what the right substitute is, perhaps the latest mtime of any file in /etc/system-image/config.d? I'm going with that for now, but we'll have to discuss whether there's something better we can use.

Revision history for this message
Barry Warsaw (barry) wrote :

Status: Lots of good progress, but this is a quite difficult branch. So many assumptions in the test suite about the config file layout need to be unwound. Still left are the D-Bus tests (test_dbus.py), the D-Bus tests in test_main.py, and one failing test which calls cli_main() twice.

The rest of this will have to probably wait until 2015.

Barry Warsaw (barry)
Changed in ubuntu-system-image:
status: In Progress → Fix Committed
Barry Warsaw (barry)
Changed in ubuntu-system-image:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.