Skip to main content

Generate config files from 'conf.d' like directories

Project description

Pypi - Downloads Pypi - Version Licence Pypi - Wheel

Generate config files from conf.d like directories.

Split your config file into smaller files in a conf.d like directory. The generated config file will be the concatenation of all splitted config files (also called snippets). The spplited files will be merged in the lexical order of their names.

Files ending with .bak, .old and other similar terminations will be ignored.

This project was based in the update-conf.d project.

Install

This project requires Python 2.6 or newer.

PS: It’s possible to use Python 3 also. However, it is not well tested.

To install:

pip install update-conf.py

It’s possible to clone the project in Github and install it via setuptools:

git clone git@github.com:rarylson/update-conf.py.git
cd update-conf.py
python setup.py install

Usage

If you run:

update-conf.py -f /etc/snmp/snmpd.conf

The script will merge the splitted config files in the directory /etc/snmp/snmpd.conf.d into the file /etc/snmp/snmpd.conf.

If the directory containing the splitted files uses a diferent name pattern, you can pass its name as an argument:

update-conf.py -f /etc/snmp/snmpd.conf -d /etc/snmp/snmpd.d

It’s also possible to define frequent used options in a config file. For example, in /etc/update-conf.py.conf:

[snmpd]
file = /etc/snmp/snmpd.conf
dir = /etc/snmp/snmpd.d

Now, you can run:

update-conf.py -n snmpd

To get help:

update-conf.py --help

Config files

update-conf.py can use config files. It will use a global config file (/etc/update-conf.py.conf) or a user-home config file (~/.update-conf.py.conf) if they exist.

When installing via setuptools or via the source distribution, the global system config (/etc/update-conf.py.conf) will be automatically created.

However, when installing via the binary wheel distribution, the config file installation will be skipped. But you can use the sample config file as a start:

cp {prefix}/share/update-conf.py /etc/update-conf.py.conf

It’s also possible to use a custom config file:

update-conf.py -c my_custom_config.conf -n snmpd

License

This software is released under the Revised BSD License.

Changelog

You can see the changelog here.

TODO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

update-conf.py-0.4.2.tar.gz (8.4 kB view hashes)

Uploaded Source

Built Distribution

update_conf.py-0.4.2-py2-none-any.whl (9.0 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page