def _get_keyfile(self, cert, metadata): """ Given a <Cert/> element and client metadata, return the full path to the file on the filesystem that the key lives in.""" keypath = cert.get("key") eset = self.cfg.entries[keypath] try: return eset.best_matching(metadata).name except PluginExecutionError: # SSL key needs to be created try: creator = eset.best_matching(metadata, eset.get_handlers(metadata, CfgCreator)) except PluginExecutionError: raise CfgCreationError("Cfg: No SSL key or key creator " "defined for %s" % keypath) keyentry = lxml.etree.Element("Path", name=keypath) creator.create_data(keyentry, metadata) tries = 0 while True: if tries >= 10: raise CfgCreationError("Cfg: Timed out waiting for event " "on SSL key at %s" % keypath) get_fam().handle_events_in_interval(1) try: return eset.best_matching(metadata).name except PluginExecutionError: tries += 1 continue
def __init__(self, metadata, sources, cachepath, basepath, debug=False): """ :param metadata: The client metadata for this collection :type metadata: Bcfg2.Server.Plugins.Metadata.ClientMetadata :param sources: A list of all sources known to the server that will be used to generate the list of sources that apply to this client :type sources: list of :class:`Bcfg2.Server.Plugins.Packages.Source.Source` objects :param cachepath: The filesystem path where cache and other temporary data will be stored :type cachepath: string :param basepath: The filesystem path to the Packages plugin directory, where more permanent data can be stored :type basepath: string :param debug: Enable debugging output :type debug: bool .. ----- .. autoattribute:: __package_groups__ """ Bcfg2.Server.Plugin.Debuggable.__init__(self) list.__init__(self, sources) self.debug_flag = debug self.metadata = metadata self.basepath = basepath self.cachepath = cachepath self.virt_pkgs = dict() self.fam = get_fam() self.setup = get_option_parser() try: self.ptype = sources[0].ptype except IndexError: self.ptype = "unknown"
def __init__(self, metadata, sources, cachepath, basepath, debug=False): """ :param metadata: The client metadata for this collection :type metadata: Bcfg2.Server.Plugins.Metadata.ClientMetadata :param sources: A list of all sources known to the server that will be used to generate the list of sources that apply to this client :type sources: list of :class:`Bcfg2.Server.Plugins.Packages.Source.Source` objects :param cachepath: The filesystem path where cache and other temporary data will be stored :type cachepath: string :param basepath: The filesystem path to the Packages plugin directory, where more permanent data can be stored :type basepath: string :param debug: Enable debugging output :type debug: bool .. ----- .. autoattribute:: __package_groups__ """ Bcfg2.Server.Plugin.Debuggable.__init__(self) list.__init__(self, sources) self.debug_flag = debug self.metadata = metadata self.basepath = basepath self.cachepath = cachepath self.virt_pkgs = dict() self.fam = get_fam() self.setup = get_option_parser() try: self.ptype = sources[0].ptype except IndexError: self.ptype = "unknown"