當前位置: 首頁>>代碼示例>>Python>>正文


Python Cfg.CfgGenerator類代碼示例

本文整理匯總了Python中Bcfg2.Server.Plugins.Cfg.CfgGenerator的典型用法代碼示例。如果您正苦於以下問題:Python CfgGenerator類的具體用法?Python CfgGenerator怎麽用?Python CfgGenerator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CfgGenerator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

 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
開發者ID:stpierre,項目名稱:bcfg2,代碼行數:8,代碼來源:CfgGenshiGenerator.py

示例2: handle_event

 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])
開發者ID:PhilMiller,項目名稱:bcfg2,代碼行數:8,代碼來源:CfgGenshiGenerator.py

示例3: handle_event

 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])
開發者ID:Ank2015,項目名稱:bcfg2,代碼行數:8,代碼來源:CfgJinja2Generator.py

示例4: __init__

 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)
開發者ID:Ank2015,項目名稱:bcfg2,代碼行數:9,代碼來源:CfgJinja2Generator.py

示例5: handle_event

 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)
開發者ID:danfoster,項目名稱:bcfg2,代碼行數:9,代碼來源:CfgEncryptedGenerator.py

示例6: handle_event

 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)
開發者ID:stpierre,項目名稱:bcfg2,代碼行數:12,代碼來源:CfgGenshiGenerator.py

示例7: handle_event

 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)
開發者ID:psteinbachs,項目名稱:bcfg2,代碼行數:12,代碼來源:CfgGenshiGenerator.py

示例8: handle_event

 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)
開發者ID:psteinbachs,項目名稱:bcfg2,代碼行數:12,代碼來源:CfgEncryptedGenerator.py

示例9: handle_event

 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)
開發者ID:nathanolla,項目名稱:bcfg2,代碼行數:13,代碼來源:CfgEncryptedGenerator.py

示例10: __init__

 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)
開發者ID:gordonmessmer,項目名稱:bcfg2,代碼行數:13,代碼來源:CfgJinja2Generator.py

示例11: handle_event

 def handle_event(self, event):
     CfgGenerator.handle_event(self, event)
     StructFile.HandleEvent(self, event)
     self.cache = dict()
開發者ID:danfoster,項目名稱:bcfg2,代碼行數:4,代碼來源:CfgAuthorizedKeysGenerator.py

示例12: __init__

 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)
開發者ID:psteinbachs,項目名稱:bcfg2,代碼行數:6,代碼來源:CfgCheetahGenerator.py

示例13: __init__

 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)
開發者ID:amplify-education,項目名稱:bcfg2,代碼行數:6,代碼來源:CfgCheetahGenerator.py

示例14: get_data

 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)
開發者ID:PhilMiller,項目名稱:bcfg2,代碼行數:4,代碼來源:CfgEncryptedGenerator.py

示例15: __init__

 def __init__(self, fname, spec, encoding):
     CfgGenerator.__init__(self, fname, spec, encoding)
     if not HAS_CRYPTO:
         raise PluginExecutionError("M2Crypto is not available")
開發者ID:PhilMiller,項目名稱:bcfg2,代碼行數:4,代碼來源:CfgEncryptedGenerator.py


注:本文中的Bcfg2.Server.Plugins.Cfg.CfgGenerator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。