From 72a80f89361145f1560ccc248f357a9de82eded6 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 17 Jan 2013 08:01:44 -0500 Subject: abstracted encryption support from Properties/CfgPrivateKeyCreator to StructFile --- src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py index 2735e389a..afa5da4c5 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py @@ -17,6 +17,8 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, __identifier__ = None + encryption = False + def __init__(self, filename, cachepath, fam, packages, setup): """ :param filename: The full path to ``sources.xml`` -- cgit v1.2.3-1-g7c22 From 45c7bbf24ae3c6530f33ebb33c062818ad44816d Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 30 Oct 2012 11:35:46 -0400 Subject: added a module-level FAM object to avoid passing it as an argument a billion times --- src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py index afa5da4c5..e06fc0410 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py @@ -19,7 +19,7 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, encryption = False - def __init__(self, filename, cachepath, fam, packages, setup): + def __init__(self, filename, cachepath, packages, setup): """ :param filename: The full path to ``sources.xml`` :type filename: string @@ -27,9 +27,6 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, :class:`Bcfg2.Server.Plugins.Packages.Source.Source` data will be cached :type cachepath: string - :param fam: The file access monitor to use to create watches - on ``sources.xml`` and any XIncluded files. - :type fam: Bcfg2.Server.FileMonitor.FileMonitor :param packages: The Packages plugin object ``sources.xml`` is being parsed on behalf of (i.e., the calling object) @@ -42,7 +39,7 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, """ Bcfg2.Server.Plugin.Debuggable.__init__(self) try: - Bcfg2.Server.Plugin.StructFile.__init__(self, filename, fam=fam, + Bcfg2.Server.Plugin.StructFile.__init__(self, filename, should_monitor=True) except OSError: err = sys.exc_info()[1] -- cgit v1.2.3-1-g7c22 From 1a031fc131d950dd49dc425ac1726337d8e93910 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 17 Jan 2013 08:01:44 -0500 Subject: abstracted encryption support from Properties/CfgPrivateKeyCreator to StructFile --- src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py index 2735e389a..afa5da4c5 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py @@ -17,6 +17,8 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, __identifier__ = None + encryption = False + def __init__(self, filename, cachepath, fam, packages, setup): """ :param filename: The full path to ``sources.xml`` -- cgit v1.2.3-1-g7c22 From 661d1f6d2789e855eff4fca38e6f4a0a564da728 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 17 Jan 2013 13:32:56 -0500 Subject: removed passing of optionparser object amongst Packages plugin --- src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py index afa5da4c5..f528076c4 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py @@ -4,6 +4,7 @@ import os import sys import Bcfg2.Server.Plugin +from Bcfg2.Options import get_option_parser from Bcfg2.Server.Plugins.Packages.Source import SourceInitError @@ -19,7 +20,7 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, encryption = False - def __init__(self, filename, cachepath, fam, packages, setup): + def __init__(self, filename, cachepath, fam, packages): """ :param filename: The full path to ``sources.xml`` :type filename: string @@ -34,8 +35,6 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, being parsed on behalf of (i.e., the calling object) :type packages: Bcfg2.Server.Plugins.Packages.Packages - :param setup: A Bcfg2 options dict - :type setup: dict :raises: :class:`Bcfg2.Server.Plugin.exceptions.PluginInitError` - If ``sources.xml`` cannot be read @@ -64,7 +63,7 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, self.logger.error("Could not create Packages cache at %s: %s" % (self.cachepath, err)) #: The Bcfg2 options dict - self.setup = setup + self.setup = get_option_parser() #: The :class:`Bcfg2.Server.Plugins.Packages.Packages` that #: instantiated this ``PackagesSources`` object @@ -159,7 +158,7 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, return None try: - source = cls(self.cachepath, xsource, self.setup) + source = cls(self.cachepath, xsource) except SourceInitError: err = sys.exc_info()[1] self.logger.error("Packages: %s" % err) -- cgit v1.2.3-1-g7c22 From 25cb6db5ccb0c8e8302c220a90344a95baf3909b Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 5 Feb 2013 14:04:09 -0500 Subject: moved some libraries in Bcfg2/ into more specific (Server/ or Client/) places --- src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py index 876ee6090..782e077bb 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py @@ -5,6 +5,7 @@ import os import sys import Bcfg2.Server.Plugin from Bcfg2.Options import get_option_parser +from Bcfg2.Server.Statistics import track_statistics from Bcfg2.Server.Plugins.Packages.Source import SourceInitError @@ -109,7 +110,7 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, load its data. """ return sorted(list(self.parsed)) == sorted(self.extras) - @Bcfg2.Server.Plugin.track_statistics() + @track_statistics() def Index(self): Bcfg2.Server.Plugin.StructFile.Index(self) self.entries = [] @@ -122,7 +123,7 @@ class PackagesSources(Bcfg2.Server.Plugin.StructFile, ``Index`` is responsible for calling :func:`source_from_xml` for each ``Source`` tag in each file. """ - @Bcfg2.Server.Plugin.track_statistics() + @track_statistics() def source_from_xml(self, xsource): """ Create a :class:`Bcfg2.Server.Plugins.Packages.Source.Source` subclass -- cgit v1.2.3-1-g7c22 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/Plugins/Packages/PackagesSources.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/PackagesSources.py') 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