diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2015-07-13 23:03:12 +0200 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2015-07-14 19:49:11 +0200 |
commit | 741e093ccd847954568ead791956565e238e8f61 (patch) | |
tree | 1125d8c5c02df121ebe24db671db00daaa9b6b6b | |
parent | 4884c74625c1fec7fe2315cbb2ea50b4d0cc991b (diff) | |
download | clufter-741e093ccd847954568ead791956565e238e8f61.tar.gz clufter-741e093ccd847954568ead791956565e238e8f61.tar.xz clufter-741e093ccd847954568ead791956565e238e8f61.zip |
format: add optional knowledge of a "void"/minimal file
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r-- | format.py | 1 | ||||
-rw-r--r-- | formats/cib.py | 13 | ||||
-rw-r--r-- | formats/cib/pacemaker-1.2.minimal | 9 |
3 files changed, 23 insertions, 0 deletions
@@ -335,6 +335,7 @@ class SimpleFormat(Format): """This is what most of the format classes want to subclass""" native_protocol = BYTESTRING = Protocol('bytestring') FILE = Protocol('file') + void_file = '/dev/null' # XXX not multi-platform def __init__(self, protocol, *args, **kwargs): """Format constructor, i.e., object = concrete uniformat data""" diff --git a/formats/cib.py b/formats/cib.py index 574ae85..d05dfa5 100644 --- a/formats/cib.py +++ b/formats/cib.py @@ -5,7 +5,11 @@ """Pacemaker configuration system/Cluster Information Base (CIB) format""" __author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>" +from os.path import dirname, isabs, join +from sys import modules + from ..format import XML +from ..utils import classproperty class cib(XML): @@ -19,6 +23,15 @@ class cib(XML): XML.ETREE: 'pacemaker-1.2.rng' } + _void_file = 'pacemaker-1.2.minimal' + + @classproperty + def void_file(cls): + if not isabs(cls._void_file): + cls._void_file = join(dirname(modules[cls.__module__].__file__), + cls.root, cls._void_file) + return cls._void_file + class cib_prelude(cib): """Private, "unfinished" pacemaker-based cluster stack configuration diff --git a/formats/cib/pacemaker-1.2.minimal b/formats/cib/pacemaker-1.2.minimal new file mode 100644 index 0000000..e09b671 --- /dev/null +++ b/formats/cib/pacemaker-1.2.minimal @@ -0,0 +1,9 @@ +<cib validate-with="pacemaker-1.2" admin_epoch="0" epoch="0" num_updates="0"> + <configuration> + <crm_config/> + <nodes/> + <resources/> + <constraints/> + </configuration> + <status/> +</cib> |