# Path: pysa/output.py
# class Output():
#     def __init__(self):
#         self.main = ''
#         self.c = {}
# 
#     @GeneralException
#     def add_dict(self, output, default = ''):
#         self.c[output] = default
# 
#     @GeneralException
#     def add(self, output, content):
#         if output:
#             self.c[output] = self.c.setdefault(output, '')
#             self.c[output] += content
#         else:
#             self.main += content
# 
#     @GeneralException
#     def dump(self, manifest_name=None):
#         return (self.c[manifest_name] if manifest_name else self.main)
# 
#     @GeneralException
#     def list(self):
#         l = ([''] if self.main else [])
#         for seq in ORDER_LIST:
#             if seq in self.c:
#                 l.append(seq)
#         return l
# 
#     @GeneralException
#     def mod(self, content, output=None):
#         if output:
#             self.c[output] = content
#         else:
#             self.main = content
# 
# Path: pysa/puppet/converter.py
# GLOBAL_SEC_EQ = {
#     'Exec'      : ACTION_ID+'Exec',
#     'exec'      : ACTION_ID+'exec',
#     'order'     : ACTION_ID+'order',
#     'require'   : SINGLE_SEC+'require'
# }


import re
from pysa.exception import *
from pysa.config import *
from pysa.tools import *
from pysa.output import Output
from pysa.puppet.converter import GLOBAL_SEC_EQ
                                                    "%s%s%s => %s"%((",\n" if wrote else ''),tab,optlabel,out))
                        wrote = True
            if wrote and label != MAIN_SECTION:
                self.__output_container.add(self.__curent_manifest, ";\n")
            elif wrote and label == MAIN_SECTION:
                self.__output_container.add(self.__curent_manifest, "\n")
            tab = Tools.tab_dec(tab)
            if label[0] != ACTION_ID:
                tab = Tools.tab_dec(tab)
        self.__output_container.add(self.__curent_manifest, "%s}\n" % (tab))
        return tab

    # class generation method, applies the recursion
    @GeneralException
    def __create_class(self, parent, data, section_name, tab):
        Tools.l(INFO, "generation class %s" % (section_name), 'create_class', self)
        self.__output_container.add(self.__curent_manifest, "%sclass %s {\n" % (tab,section_name))
        tab = Tools.tab_inc(tab)
        # recursion here
        tab = self.__generate(data[section_name], data, tab)
        tab = Tools.tab_dec(tab)
        self.__output_container.add(self.__curent_manifest, "%s}\n%sinclude %s\n" % (tab,tab,section_name))
        return tab

    # puppet file generation function
    # recursive function
    @GeneralException
    def __generate(self, data, parent = None, tab=''):
        # adding Exec section
        if GLOBAL_SEC_EQ['Exec'] in data:

# Path: pysa/output.py
# class Output():
#     def __init__(self):
#         self.main = ''
#         self.c = {}
# 
#     @GeneralException
#     def add_dict(self, output, default = ''):
#         self.c[output] = default
# 
#     @GeneralException
#     def add(self, output, content):
#         if output:
#             self.c[output] = self.c.setdefault(output, '')
#             self.c[output] += content
#         else:
#             self.main += content
# 
#     @GeneralException
#     def dump(self, manifest_name=None):
#         return (self.c[manifest_name] if manifest_name else self.main)
# 
#     @GeneralException
#     def list(self):
#         l = ([''] if self.main else [])
#         for seq in ORDER_LIST:
#             if seq in self.c:
#                 l.append(seq)
#         return l
# 
#     @GeneralException
#     def mod(self, content, output=None):
#         if output:
#             self.c[output] = content
#         else:
#             self.main = content
# 
# Path: pysa/puppet/converter.py
# GLOBAL_SEC_EQ = {
#     'Exec'      : ACTION_ID+'Exec',
#     'exec'      : ACTION_ID+'exec',
#     'order'     : ACTION_ID+'order',
#     'require'   : SINGLE_SEC+'require'
# }


# Path: pysa/puppet/build.py
import re
from pysa.exception import *
from pysa.config import *
from pysa.tools import *
from pysa.output import Output
from pysa.puppet.converter import GLOBAL_SEC_EQ

                                                    "%s%s%s => %s"%((",\n" if wrote else ''),tab,optlabel,out))
                        wrote = True
            if wrote and label != MAIN_SECTION:
                self.__output_container.add(self.__curent_manifest, ";\n")
            elif wrote and label == MAIN_SECTION:
                self.__output_container.add(self.__curent_manifest, "\n")
            tab = Tools.tab_dec(tab)
            if label[0] != ACTION_ID:
                tab = Tools.tab_dec(tab)
        self.__output_container.add(self.__curent_manifest, "%s}\n" % (tab))
        return tab

    # class generation method, applies the recursion
    @GeneralException
    def __create_class(self, parent, data, section_name, tab):
        Tools.l(INFO, "generation class %s" % (section_name), 'create_class', self)
        self.__output_container.add(self.__curent_manifest, "%sclass %s {\n" % (tab,section_name))
        tab = Tools.tab_inc(tab)
        # recursion here
        tab = self.__generate(data[section_name], data, tab)
        tab = Tools.tab_dec(tab)
        self.__output_container.add(self.__curent_manifest, "%s}\n%sinclude %s\n" % (tab,tab,section_name))
        return tab

    # puppet file generation function
    # recursive function
    @GeneralException
    def __generate(self, data, parent = None, tab=''):
        # adding Exec section
        if GLOBAL_SEC_EQ['Exec'] in data:

            tab = self.__create_content(parent, data, GLOBAL_SEC_EQ['Exec'], tab)