Skip to content

How about a configfs with Config::Model ?

November 23, 2010

Hello

During the Config::Model presentation at Debian mini-conf, I was asked whether Config::Model could be used from other languages than Perl.

Of course, config-edit command line can be launched from any program with any language, but we can hardly call it an API.

There’s also the possibility to use Config::Model::SimpleUI to fork a process and send commands on its STDIN and get results on STDOUT. But using this from another program is awkward.

On kernel side, /proc and /sys are widely used to get information from the kernel and set kernel configuration.

How about using a similar approach with system configuration data ?

Configuration data from config files is already mapped into a tree within Config::Model. This tree can also be mapped to a file system structure. This file system structure could have the following layout:

/conf/
`–system/
|–sshd/
| `– PermitRootLogin # contain 0 or 1
|–ssh/
| …
`–popcon/

As a bonus, this file system would provide a unified access to all system configuration data available through Config::Model.

In any case, people would still be able to tinker configuration with their favorite text editor on a file in /etc. The modification will be propagated to the corresponding entry in the /conf virtual file system. The reverse will also be done.

Anyone interested ?

All the best

PS: Further technical discussion will be held on Config::Model mailing list: config-model-users at lists.sourceforge.net

2010.11.25 edit: specified that config data can still be written in usual config file.

Advertisements

From → Perl

6 Comments
  1. Paul Tötterman permalink

    How does Config::Model compare to Augeas?

    • As mentioned in description of libconfig-model-augeas-perl:

      Config::Model and Augeas are both configuration editing tool. Both parse configuration files in their native formats and transforms them into a tree. Configuration changes are made by manipulating this tree and saving it back into native config files.

      Both Augeas and Config::Model rely on a tree to represent configuration data.

      On one side, Augeas is able to load and write data while respecting the structure and comments of the original configuration file. But Augeas purpose is not to validate the semantic content of the configuration file.

      On the other side, Config::Model is able to validate the semantic content of the configuration file, but it may discard comments and will write back configuration data using a canonical order. Thus the structure of the original configuration file is not preserved.

      So, in summary, they are complementary.

  2. harry666t permalink

    > Anyone interested ?

    YES YES YES!

    I was just thinking that Linux would be much prettier if it was more Plan9-like, i.e. all resources exposed via synthetic file systems, per-process name spaces, union directories, etc. A lot of that has already been done, but at the moment it’s a bit clumsy, and generally you need elevated privileges to do interesting stuff.

    By the way, does FUSE do anything that 9P doesn’t?

    • well, I had to look up 9P on wikipedia. At first look, I’d say that 9P can also provide a virtual file system from a remote system.

      But currently, the main strong point of FUSE compared to 9P is that a Fuse module is available in Perl…

    • Done. This feature is available in Config::Model 1.226. I’ll soon write a blog to provide more details on this feature. Until then, you can read Config::Model::FuseUI man page. This page shows how to use the config-edit command line to configure Debian’s popularity contest through a virtual file system.

Trackbacks & Pingbacks

  1. How to configure OpenSsh through a virtual filesystem « Ddumont's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: