Example #1
0
 def __init__(self, fname, spec, encoding):
     CfgGenerator.__init__(self, fname, spec, encoding)
     if not have_genshi:
         msg = "Cfg: Genshi is not available: %s" % fname
         logger.error(msg)
         raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
     self.loader = self.__loader_cls__()
     self.template = None
Example #2
0
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     try:
         self.template = self.loader.load(self.name, cls=NewTextTemplate,
                                          encoding=self.encoding)
     except:
         raise PluginExecutionError("Failed to load template: %s" %
                                    sys.exc_info()[1])
 def __init__(self, fname, spec, encoding):
     CfgGenerator.__init__(self, fname, spec, encoding)
     if not have_genshi:
         msg = "Cfg: Genshi is not available: %s" % fname
         logger.error(msg)
         raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
     self.loader = self.__loader_cls__()
     self.template = None
Example #4
0
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     try:
         self.template = \
             self.environment.get_template(self.name)
     except:
         raise PluginExecutionError("Failed to load template: %s" %
                                    sys.exc_info()[1])
Example #5
0
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     try:
         self.template = \
             self.environment.get_template(self.name)
     except:
         raise PluginExecutionError("Failed to load template: %s" %
                                    sys.exc_info()[1])
Example #6
0
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     if self.data is None:
         return
     # todo: let the user specify a passphrase by name
     try:
         self.data = bruteforce_decrypt(self.data)
     except EVPError:
         raise PluginExecutionError("Failed to decrypt %s" % self.name)
Example #7
0
 def __init__(self, fname, spec):
     CfgGenerator.__init__(self, fname, spec)
     if not HAS_JINJA2:
         raise PluginExecutionError("Jinja2 is not available")
     self.template = None
     encoding = Bcfg2.Options.setup.encoding
     self.loader = self.__loader_cls__('/',
                                       encoding=encoding)
     self.environment = self.__environment_cls__(loader=self.loader)
Example #8
0
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     try:
         self.template = \
             self.loader.load(self.name, cls=NewTextTemplate,
                              encoding=Bcfg2.Options.setup.encoding)
     except:
         raise PluginExecutionError("Failed to load template: %s" %
                                    sys.exc_info()[1])
Example #9
0
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     if self.data is None:
         return
     # todo: let the user specify a passphrase by name
     try:
         self.data = bruteforce_decrypt(self.data)
     except EVPError:
         raise PluginExecutionError("Failed to decrypt %s" % self.name)
Example #10
0
 def handle_event(self, event):
     if event.code2str() == 'deleted':
         return
     CfgGenerator.handle_event(self, event)
     try:
         self.template = self.loader.load(self.name, cls=NewTextTemplate,
                                          encoding=self.encoding)
     except Exception:
         msg = "Cfg: Could not load template %s: %s" % (self.name,
                                                        sys.exc_info()[1])
         logger.error(msg)
         raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     if self.data is None:
         return
     # todo: let the user specify a passphrase by name
     try:
         self.data = bruteforce_decrypt(self.data, setup=SETUP,
                                        algorithm=get_algorithm(SETUP))
     except EVPError:
         msg = "Failed to decrypt %s" % self.name
         LOGGER.error(msg)
         raise PluginExecutionError(msg)
Example #12
0
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     if self.data is None:
         return
     try:
         self.template = self.loader.load(self.name, cls=NewTextTemplate,
                                          encoding=self.encoding)
     except:
         msg = "Cfg: Could not load template %s: %s" % (self.name,
                                                        sys.exc_info()[1])
         LOGGER.error(msg)
         raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
Example #13
0
 def __init__(self, fname, spec):
     CfgGenerator.__init__(self, fname, spec)
     if not HAS_JINJA2:
         raise PluginExecutionError("Jinja2 is not available")
     self.template = None
     encoding = Bcfg2.Options.setup.encoding
     self.loader = self.__loader_cls__("/", encoding=encoding)
     try:
         # keep_trailing_newline is new in Jinja2 2.7, and will
         # fail with earlier versions
         self.environment = self.__environment_cls__(loader=self.loader, keep_trailing_newline=True)
     except TypeError:
         self.environment = self.__environment_cls__(loader=self.loader)
Example #14
0
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     if self.data is None:
         return
     # todo: let the user specify a passphrase by name
     try:
         self.data = bruteforce_decrypt(self.data)
     except EVPError:
         msg = "Cfg: Failed to decrypt %s" % self.name
         if Bcfg2.Options.setup.lax_decryption:
             self.logger.debug(msg)
         else:
             raise PluginExecutionError(msg)
Example #15
0
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     if self.data is None:
         return
     # todo: let the user specify a passphrase by name
     try:
         self.data = bruteforce_decrypt(self.data)
     except EVPError:
         msg = "Cfg: Failed to decrypt %s" % self.name
         if Bcfg2.Options.setup.lax_decryption:
             self.logger.debug(msg)
         else:
             raise PluginExecutionError(msg)
 def handle_event(self, event):
     if event.code2str() == 'deleted':
         return
     CfgGenerator.handle_event(self, event)
     try:
         self.template = self.loader.load(self.name,
                                          cls=NewTextTemplate,
                                          encoding=self.encoding)
     except Exception:
         msg = "Cfg: Could not load template %s: %s" % (self.name,
                                                        sys.exc_info()[1])
         logger.error(msg)
         raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
Example #17
0
 def __init__(self, fname, spec):
     CfgGenerator.__init__(self, fname, spec)
     if not HAS_JINJA2:
         raise PluginExecutionError("Jinja2 is not available")
     self.template = None
     encoding = Bcfg2.Options.setup.encoding
     self.loader = self.__loader_cls__('/', encoding=encoding)
     try:
         # keep_trailing_newline is new in Jinja2 2.7, and will
         # fail with earlier versions
         self.environment = \
             self.__environment_cls__(loader=self.loader,
                                      keep_trailing_newline=True)
     except TypeError:
         self.environment = \
             self.__environment_cls__(loader=self.loader)
Example #18
0
 def get_data(self, entry, metadata):
     if self.data is None:
         raise PluginExecutionError("Failed to decrypt %s" % self.name)
     return CfgGenerator.get_data(self, entry, metadata)
 def __init__(self, fname):
     CfgGenerator.__init__(self, fname, None)
     StructFile.__init__(self, fname)
     self.cache = dict()
     self.core = get_cfg().core
Example #20
0
 def __init__(self, fname, spec):
     CfgGenerator.__init__(self, fname, spec)
     self.template = None
     self.loader = self.__loader_cls__(max_cache_size=0)
Example #21
0
 def __init__(self, fname, spec, encoding):
     CfgGenerator.__init__(self, fname, spec, encoding)
     if not HAS_CRYPTO:
         raise PluginExecutionError("M2Crypto is not available")
 def get_data(self, entry, metadata):
     if self.data is None:
         raise PluginExecutionError("Failed to decrypt %s" % self.name)
     return CfgGenerator.get_data(self, entry, metadata)
Example #23
0
 def __init__(self, fname, spec):
     CfgGenerator.__init__(self, fname, spec)
     if not HAS_CHEETAH:
         raise PluginExecutionError("Cheetah is not available")
 def __init__(self, fname, spec, encoding):
     CfgGenerator.__init__(self, fname, spec, encoding)
     if not HAS_CRYPTO:
         msg = "Cfg: M2Crypto is not available"
         LOGGER.error(msg)
         raise PluginExecutionError(msg)
Example #25
0
 def __init__(self, fname, spec, encoding):
     CfgGenerator.__init__(self, fname, spec, encoding)
     if not HAS_CHEETAH:
         msg = "Cfg: Cheetah is not available: %s" % self.name
         LOGGER.error(msg)
         raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
Example #26
0
 def __init__(self, fname, spec):
     CfgGenerator.__init__(self, fname, spec)
     if not HAS_CRYPTO:
         raise PluginExecutionError("M2Crypto is not available")
Example #27
0
 def __init__(self, fname, spec):
     CfgGenerator.__init__(self, fname, spec)
     if not HAS_CHEETAH:
         raise PluginExecutionError("Cheetah is not available")
Example #28
0
 def __init__(self, fname, spec):
     CfgGenerator.__init__(self, fname, spec)
     if not HAS_JINJA2:
         raise PluginExecutionError("Jinja2 is not available")
Example #29
0
 def __init__(self, fname, spec, encoding):
     CfgGenerator.__init__(self, fname, spec, encoding)
     if not HAS_CHEETAH:
         msg = "Cfg: Cheetah is not available: %s" % self.name
         LOGGER.error(msg)
         raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     StructFile.HandleEvent(self, event)
     self.cache = dict()
Example #31
0
 def ignore(cls, event, basename=None):
     return (event.filename.endswith(".genshi_include") or
             CfgGenerator.ignore(event, basename=basename))
Example #32
0
 def __init__(self, fname, spec):
     CfgGenerator.__init__(self, fname, spec)
     if not HAS_JINJA2:
         raise PluginExecutionError("Jinja2 is not available")
Example #33
0
 def __init__(self, fname, spec, encoding):
     CfgGenerator.__init__(self, fname, spec, encoding)
     if not have_cheetah:
         msg = "Cfg: Cheetah is not available: %s" % entry.get("name")
         logger.error(msg)
         raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
Example #34
0
 def __init__(self, fname, spec):
     CfgGenerator.__init__(self, fname, spec)
     self.template = None
     self.loader = self.__loader_cls__(max_cache_size=0)
 def __init__(self, fname):
     CfgGenerator.__init__(self, fname, None, None)
     StructFile.__init__(self, fname)
     self.cache = dict()
     self.core = CFG.core
 def ignore(cls, event, basename=None):
     return (event.filename.endswith(".genshi_include")
             or CfgGenerator.ignore(event, basename=basename))
Example #37
0
 def __init__(self, fname, spec, encoding):
     CfgGenerator.__init__(self, fname, spec, encoding)
     if not HAS_GENSHI:
         raise PluginExecutionError("Genshi is not available")
     self.template = None
     self.loader = self.__loader_cls__(max_cache_size=0)
 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     StructFile.HandleEvent(self, event)
     self.cache = dict()