Generic system architecture for Linux configuration tool

I am going to write a configuration tool for my Ubuntu based system. Then I would like to write interfaces (text, graphical interface and web interface). But this is the most complex project that I wanted to write, and I'm not sure about the general architecture that I should use.

In the current state, I have functions and classes for changing the system configuration. But these functions are likely to grow and change. @Abki gave me advice on how to write an interface for interfaces. I am going to make base classes for this interface, but I do not know how to connect it with the backend, and then with the interfaces. I should probably use design patterns like fasade, wrapper or something else.

It looks like (without interface_to_backend layer):

enter image description here

I do not need the user interface and functions to change the system configuration. But I don’t know how to write the middle layer, so it would be easy to connect it with the rest and expand the functionality in the future.

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

+4
source share
3 answers

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

My initial suggestion is that you should consider several bidders. In particular, I will look at cfengine, chef and bcfg2. They each tell a different story, but if I summed up, I would say:

  • Chef has excellent dsl syntax but is omitted by complex architecture.
  • bcfg2 is written in python, but seems to cause an annoying tendency to use XML :(
  • cfengine has the strongest theoretical foundations of the theory of promises (this is v.interesting BTW), but is based on C.

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

Regarding developing your own tool, I would suggest that there are three principles you want to pursue:

  • Simplicity, the simpler the better. Simple in terms of volume, configuration and use is important.
  • You need one way to store data, you should be able to track choices as they are created, and not squander other people's changes (especially in a team environment).
  • Security. In most cases, most configuration management tools require root privileges. Therefore, you need to make sure that users can trust the code in which they work.
+1
source

You can use Fabric with Python, as described in Configuring Ubuntu Server Using Python Fabric

The Wikipedia article Comparison of Open Source Configuration Management Software contains several other tools that Python uses for this.

I like the SALT approach.

+1
source

If you write GUIs, text / CLIs, and web interfaces using Python, they can all use the same Python module. Thus, changing one interface transparently affects others. Plus they are all in the area of ​​Python power.

0
source

Source: https://habr.com/ru/post/1393274/


All Articles