diff options
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugin/helpers.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugin/helpers.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py index 2d157eba9..7a3d887fe 100644 --- a/src/lib/Bcfg2/Server/Plugin/helpers.py +++ b/src/lib/Bcfg2/Server/Plugin/helpers.py @@ -597,17 +597,14 @@ class XMLFileBacked(FileBacked): Index.__doc__ = FileBacked.Index.__doc__ def add_monitor(self, fpath): - """ Add a FAM monitor to a file that has been XIncluded. This - is only done if the constructor got both a ``fam`` object and - ``should_monitor`` set to True. + """ Add a FAM monitor to a file that has been XIncluded. :param fpath: The full path to the file to monitor :type fpath: string :returns: None """ self.extra_monitors.append(fpath) - if self.should_monitor: - self.fam.AddMonitor(fpath, self) + self.fam.AddMonitor(fpath, self) def __iter__(self): return iter(self.entries) @@ -631,6 +628,9 @@ class StructFile(XMLFileBacked): #: the file being cached __identifier__ = None + #: Whether or not to enable encryption + encryption = True + #: Callbacks used to determine if children of items with the given #: tags should be included in the return value of #: :func:`Bcfg2.Server.Plugin.helpers.StructFile.Match` and @@ -674,7 +674,7 @@ class StructFile(XMLFileBacked): self.logger.error('Genshi parse error in %s: %s' % (self.name, err)) - if HAS_CRYPTO: + if HAS_CRYPTO and self.encryption: lax_decrypt = self.xdata.get( "lax_decryption", str(Bcfg2.Options.setup.lax_decryption)).lower() == "true" @@ -925,6 +925,7 @@ class PriorityStructFile(StructFile): __init__.__doc__ = StructFile.__init__.__doc__ def Index(self): + StructFile.Index(self) try: self.priority = int(self.xdata.get('priority')) except (ValueError, TypeError): @@ -955,13 +956,13 @@ class PrioDir(Plugin, Generator, XMLDirectoryBacked): def HandleEvent(self, event): XMLDirectoryBacked.HandleEvent(self, event) self.Entries = {} - for src in list(self.entries.values()): - for itype, children in list(src.items.items()): - for child in children: - try: - self.Entries[itype][child] = self.BindEntry - except KeyError: - self.Entries[itype] = {child: self.BindEntry} + for src in self.entries.values(): + for child in src.xdata.iterchildren(): + if child.tag in ['Group', 'Client']: + continue + if child.tag not in self.Entries: + self.Entries[child.tag] = dict() + self.Entries[child.tag][child.get("name")] = self.BindEntry HandleEvent.__doc__ = XMLDirectoryBacked.HandleEvent.__doc__ def _matches(self, entry, metadata, candidate): # pylint: disable=W0613 |