marcinpz
marcinpz

Reputation: 675

General system architecture for Linux configuration tool

I am going to write configuration tool for my Ubuntu based system. Next I would like to write frontends (text, GUI and web). But it is the most complicated project I wanted to write and I am not sure about general architecture I should use.

At the current I have functions and classes for changing system config. But these functions will probably grow & change. @Abki gave me advice how to write interface for frontends. I am going to make base classes for this interface but I don't know how to connect it with backend and next with frontends. Probably I should use design patterns like fasade, wrapper or something else.

It looks like (without interface_to_backend layer):

enter image description here

I don't care about UI and functions to change system config now. But I don't know how to write middle layer so It would be easy to connect it with the rest and extend functionality i the future.

I need general ideas, design patterns, advices how to implement this in Python.

Upvotes: 4

Views: 380

Answers (3)

Michael Dillon
Michael Dillon

Reputation: 32392

You could use Fabric with Python as described in the article Ubuntu Server Setup with Python Fabric

The Wikipedia article at Comparison of open source configuration management software has several other tools that use Python to do this.

I like the approach taken by SALT.

Upvotes: 1

robertpostill
robertpostill

Reputation: 3980

I'm not sure this is entirely appropriate for SO but I'm intrigued and so I'll bite. As a rubyist I can't help much with the Python but here is some opinion on pattens from my experience.

My initial suggestion is you should review a few of the contenders out there. Specifically I'd be looking at cfengine, chef and bcfg2. They each tell a different story but if I'd summarise I'd say:

  • Chef has a lovely dsl syntax but is let down by a complicated architecture
  • bcfg2 is written in python but seems to have an annoying tendency to use XML :(
  • cfengine has the strongest theoretical underpinnings in promise theory (which is v.interesting BTW) but is C based.

Wikipedia also provides a pretty impressive list of configuration management tools that you will find useful.

In regard to designing your own tool I'd suggest there are three principles you want to pursue:

  1. Simplicity, the simpler you make this the better. Simple in terms of scope, configuration and use are all important.
  2. You'll need a single way to store data, you need to be able to trace the choices as they are made and not trample other people's changes (especially in a team environment).
  3. Security, most configuration management tools need root privileges at some point. So you need to make sure that users can trust the code they're running.

Upvotes: 1

Brigand
Brigand

Reputation: 86260

If you write the GUI, text/CLI, and Web interfaces using Python, they can all use the same Python module. That way a change in one interface transparently affects the others. Plus all of those are in Python's area of strength.

Upvotes: 0

Related Questions