summaryrefslogtreecommitdiffstats
path: root/formats/simpleconfig.py
blob: 8de406006dce3895c94f9f7e58694c58b6245d8c (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
# -*- coding: UTF-8 -*-
# Copyright 2012 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2 (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
"""Structured configuration formats such as corosync.conf"""
__author__ = "Jan Pokorný <jpokorny at redhat dot com>"

from ..format import Format, producing


class simpleconfig(Format):
    """"Structured configuration formats such as corosync.conf"""
    # yacc-based parser in fence-virt
    native_protocol = 'struct'

    @producing('bytestring')
    def get_bytestring(self, protocol):
        ret = super(Format, self).get_bytestring(self)
        if ret is not None:
            return ret

        # fallback
        # XXX TODO self('struct')
        raise NotImplementedError

    @producing('struct', protect=True)
    def get_struct(self, protocol):
        #return etree.fromstring(self('bytestring')).getroottree()
        pass