Skip to content

Commit

Permalink
keep rules_file as obsolete option
Browse files Browse the repository at this point in the history
  • Loading branch information
julien6387 committed Nov 20, 2021
1 parent b6e6605 commit 4d370a7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -16,6 +16,7 @@
* Fix issue in statistics compiler when network interfaces are dynamically created / removed.

* The option `rules_file` is updated to `rules_files` and supports multiple files for **Supvisors** rules.
The option `rules_file` is thus obsolete and will be removed in next version.

* Add a new `restart_sequence` XML-RPC to trigger a full application start sequence.

Expand Down
27 changes: 19 additions & 8 deletions docs/configuration.rst
Expand Up @@ -58,6 +58,17 @@ parameters) or it may lead to unpredictable behavior.

*Required*: No.

``rules_file``

**Obsolete. Will be removed in next version. Please use ``rules_files`` instead.**
The absolute or relative path of the XML rules file. The contents of this file is described in
`Supvisors' Rules File`_.

*Default*: None.

*Required*: No.


``auto_fence``

When true, |Supvisors| won't try to reconnect to a |Supvisors| instance that is inactive.
Expand Down Expand Up @@ -273,31 +284,31 @@ Configuration File Example
.. _rules_file:

|Supvisors|' Rules File
--------------------------
-----------------------

This part describes the contents of the XML rules file declared in the ``rules_file`` option.
This part describes the contents of the XML rules files declared in the ``rules_files`` option.

Basically, the rules file contains rules that define how applications and programs should be started and stopped,
Basically, a rules file contains rules that define how applications and programs should be started and stopped,
and the quality of service expected. It relies on the |Supervisor| group and program definitions.

.. important:: *About the declaration of Supervisor groups/processes in the rules file*
.. important:: *About the declaration of Supervisor groups/processes in a rules file*

It is important to notice that all applications declared in this file will be considered as *Managed*
by |Supvisors|. The main consequence is that |Supvisors| will try to ensure that one single instance of the program
is running over all the nodes considered. If two instances of the same program are running on two different nodes,
|Supvisors| will consider this as a conflict. Only the *Managed* applications have an entry in the navigation menu
of the |Supvisors| web page.

The groups declared in |Supervisor| configuration files and not declared in the rules file will thus be considered
The groups declared in |Supervisor| configuration files and not declared in a rules file will thus be considered
as *Unmanaged* by |Supvisors|. So they have no entry in the navigation menu of the |Supvisors| web page.
There can be as many running instances of the same program as |Supervisor| allows over the available nodes.

If the `lxml <http://lxml.de>`_ package is available on the system, |Supvisors| uses it to validate
the XML rules file before it is used.
If the `lxml <http://lxml.de>`_ package is available on the system, |Supvisors| uses it to validate the XML rules files
before they are used.

.. hint::

It is still possible to validate the XML rules file manually. The XSD file :file:`rules.xsd` used to validate the
It is still possible to validate the XML rules files manually. The XSD file :file:`rules.xsd` used to validate the
XML can be found in the |Supvisors| package. Just use :command:`xmllint` to validate:

.. code-block:: bash
Expand Down
3 changes: 2 additions & 1 deletion supvisors/options.py
Expand Up @@ -71,7 +71,8 @@ def __init__(self, supervisord, **config):
# get values from config
self.node_list = filter(None, list_of_strings(config.get('address_list', gethostname())))
self.node_list = list(OrderedDict.fromkeys(self.node_list))
self.rules_files = config.get('rules_files', None)
# keep rules_file for next version but state obsolescence
self.rules_files = config.get('rules_files', config.get('rules_file', None))
if self.rules_files:
self.rules_files = self.to_filepaths(self.rules_files)
self.internal_port = self.to_port_num(config.get('internal_port', '65001'))
Expand Down

0 comments on commit 4d370a7

Please sign in to comment.