From 7db65d41386768a5081c34c16db17e82b96a5b7a Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 7 Feb 2013 08:26:39 -0500 Subject: made XInlcude and Encryption support more consistent --- src/lib/Bcfg2/Server/Plugin/helpers.py | 6 +----- src/lib/Bcfg2/Server/Plugins/FileProbes.py | 11 ++++------ src/lib/Bcfg2/Server/Plugins/NagiosGen.py | 24 ++++------------------ .../Server/Plugins/Packages/PackagesSources.py | 4 ---- 4 files changed, 9 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py index 2daf4e0df..9bdfe347f 100644 --- a/src/lib/Bcfg2/Server/Plugin/helpers.py +++ b/src/lib/Bcfg2/Server/Plugin/helpers.py @@ -517,9 +517,6 @@ class StructFile(XMLFileBacked, Debuggable): #: the file being cached __identifier__ = None - #: Whether or not encryption support is enabled in this file - 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 @@ -564,7 +561,7 @@ class StructFile(XMLFileBacked, Debuggable): self.logger.error('Genshi parse error in %s: %s' % (self.name, err)) - if self.encryption and HAS_CRYPTO: + if HAS_CRYPTO: strict = self.xdata.get( "decrypt", self.setup.cfp.get(Bcfg2.Server.Encryption.CFG_SECTION, @@ -879,7 +876,6 @@ class XMLSrc(XMLFileBacked): class InfoXML(StructFile): """ InfoXML files contain Group, Client, and Path tags to set the metadata (permissions, owner, etc.) of files. """ - encryption = False _include_tests = StructFile._include_tests _include_tests['Path'] = lambda el, md, entry, *args: \ diff --git a/src/lib/Bcfg2/Server/Plugins/FileProbes.py b/src/lib/Bcfg2/Server/Plugins/FileProbes.py index 461b718e2..33914bd45 100644 --- a/src/lib/Bcfg2/Server/Plugins/FileProbes.py +++ b/src/lib/Bcfg2/Server/Plugins/FileProbes.py @@ -52,11 +52,6 @@ print(Bcfg2.Client.XML.tostring(data, xml_declaration=False).decode('UTF-8')) """ -class FileProbesConfig(Bcfg2.Server.Plugin.StructFile): - """ Config file for FileProbes """ - encryption = False - - class FileProbes(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Probing): """ This module allows you to probe a client for a file, which is then @@ -69,8 +64,10 @@ class FileProbes(Bcfg2.Server.Plugin.Plugin, def __init__(self, core, datastore): Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore) Bcfg2.Server.Plugin.Probing.__init__(self) - self.config = FileProbesConfig(os.path.join(self.data, 'config.xml'), - should_monitor=True) + self.config = \ + Bcfg2.Server.Plugin.StructFile(os.path.join(self.data, + 'config.xml'), + should_monitor=True) self.entries = dict() self.probes = dict() diff --git a/src/lib/Bcfg2/Server/Plugins/NagiosGen.py b/src/lib/Bcfg2/Server/Plugins/NagiosGen.py index c377ca4ef..d5ea0cb24 100644 --- a/src/lib/Bcfg2/Server/Plugins/NagiosGen.py +++ b/src/lib/Bcfg2/Server/Plugins/NagiosGen.py @@ -5,27 +5,8 @@ import re import sys import glob import socket -import logging -import Bcfg2.Server import Bcfg2.Server.Plugin -LOGGER = logging.getLogger(__name__) - - -class NagiosGenConfig(Bcfg2.Server.Plugin.StructFile): - """ NagiosGen config file handler """ - encryption = False - - def __init__(self, filename): - # create config.xml if missing - if not os.path.exists(filename): - LOGGER.warning("NagiosGen: %s missing. " - "Creating empty one for you." % filename) - open(filename, "w").write("") - - Bcfg2.Server.Plugin.StructFile.__init__(self, filename, - should_monitor=True) - class NagiosGen(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Generator): @@ -37,7 +18,10 @@ class NagiosGen(Bcfg2.Server.Plugin.Plugin, def __init__(self, core, datastore): Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore) Bcfg2.Server.Plugin.Generator.__init__(self) - self.config = NagiosGenConfig(os.path.join(self.data, 'config.xml')) + self.config = \ + Bcfg2.Server.Plugin.StructFile(os.path.join(self.data, + 'config.xml'), + should_monitor=True) self.Entries = {'Path': {'/etc/nagiosgen.status': self.createhostconfig, '/etc/nagios/nagiosgen.cfg': self.createserverconfig}} diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py index 782e077bb..e9744c777 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py @@ -17,10 +17,6 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, :class:`Bcfg2.Server.Plugins.Packages.Source.Source` object for each ``Source`` tag. """ - __identifier__ = None - - encryption = False - def __init__(self, filename, cachepath, packages): """ :param filename: The full path to ``sources.xml`` -- cgit v1.2.3-1-g7c22