Support config.d directory

Bug #1373467 reported by James Hunt on 2014-09-24
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu system image
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


or similar?

Related branches

Barry Warsaw (barry) on 2014-09-24
no longer affects: system-image (Ubuntu)
tags: added: client
Changed in ubuntu-system-image:
status: New → Triaged
Barry Warsaw (barry) on 2014-09-24
Changed in ubuntu-system-image:
milestone: none → 2.5
Barry Warsaw (barry) on 2014-09-25
Changed in ubuntu-system-image:
importance: Undecided → High
assignee: nobody → Barry Warsaw (barry)
Barry Warsaw (barry) on 2014-09-26
Changed in ubuntu-system-image:
milestone: 2.5 → 3.0
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) on 2014-10-06
summary: - Ability to specify alternate client.ini
+ Support config.d directory
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.

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 (, the D-Bus tests in, and one failing test which calls cli_main() twice.

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

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

Other bug subscribers