summaryrefslogtreecommitdiffstats
path: root/formats/cib.py
blob: d05dfa598736d78cf831cf6cf00bb04fcf587de1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- coding: UTF-8 -*-
# Copyright 2015 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
"""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):
    """Pacemaker-based cluster stack configuration (as XML/CIB)

    Also known as Pacemaker Configuration System (cib).
    """
    # XML
    root = 'cib'
    validator_specs = {
        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

    This is a result of ccsflat2cibprelude filter.
    """


class cib_compact(cib):
    """Private, "unfinished" pacemaker-based cluster stack configuration

    This is a result of cibprelude2cibcompact filter.
    """


class cib_final(cib):
    """Public, "finished" pacemaker-based cluster stack configuration

    This is a result of cib2cibfinal filter.
    """