From 6dd9756f7a87d5e875f5db02f306c7b906902a96 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 29 Oct 2013 10:21:12 -0400 Subject: Plugins: refactored out unnecessary datastore constructor argument --- src/lib/Bcfg2/Server/Plugin/base.py | 8 +++----- src/lib/Bcfg2/Server/Plugin/helpers.py | 8 ++++---- src/lib/Bcfg2/Server/Plugin/interfaces.py | 10 +++++----- 3 files changed, 12 insertions(+), 14 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugin') diff --git a/src/lib/Bcfg2/Server/Plugin/base.py b/src/lib/Bcfg2/Server/Plugin/base.py index b2d9fa7c8..549f7b543 100644 --- a/src/lib/Bcfg2/Server/Plugin/base.py +++ b/src/lib/Bcfg2/Server/Plugin/base.py @@ -1,6 +1,7 @@ """This module provides the base class for Bcfg2 server plugins.""" import os +import Bcfg2.Options from Bcfg2.Logger import Debuggable from Bcfg2.Utils import ClassName @@ -53,13 +54,10 @@ class Plugin(Debuggable): #: but not ``__rmi__`` will be ignored. __child_rmi__ = Debuggable.__child_rmi__ - def __init__(self, core, datastore): + def __init__(self, core): """ :param core: The Bcfg2.Server.Core initializing the plugin :type core: Bcfg2.Server.Core - :param datastore: The path to the Bcfg2 repository on the - filesystem - :type datastore: string :raises: :exc:`OSError` if adding a file monitor failed; :class:`Bcfg2.Server.Plugin.exceptions.PluginInitError` on other errors @@ -69,7 +67,7 @@ class Plugin(Debuggable): Debuggable.__init__(self, name=self.name) self.Entries = {} self.core = core - self.data = os.path.join(datastore, self.name) + self.data = os.path.join(Bcfg2.Options.setup.repository, self.name) if self.create and not os.path.exists(self.data): self.logger.warning("%s: %s does not exist, creating" % (self.name, self.data)) diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py index 98cd250dd..4cd87bd70 100644 --- a/src/lib/Bcfg2/Server/Plugin/helpers.py +++ b/src/lib/Bcfg2/Server/Plugin/helpers.py @@ -944,8 +944,8 @@ class PrioDir(Plugin, Generator, XMLDirectoryBacked): #: :class:`Bcfg2.Server.Plugin.helpers.PriorityStructFile` __child__ = PriorityStructFile - def __init__(self, core, datastore): - Plugin.__init__(self, core, datastore) + def __init__(self, core): + Plugin.__init__(self, core) Generator.__init__(self) XMLDirectoryBacked.__init__(self, self.data) __init__.__doc__ = Plugin.__init__.__doc__ @@ -1483,8 +1483,8 @@ class GroupSpool(Plugin, Generator): #: object. entry_type = 'Path' - def __init__(self, core, datastore): - Plugin.__init__(self, core, datastore) + def __init__(self, core): + Plugin.__init__(self, core) Generator.__init__(self) self.fam = Bcfg2.Server.FileMonitor.get_fam() diff --git a/src/lib/Bcfg2/Server/Plugin/interfaces.py b/src/lib/Bcfg2/Server/Plugin/interfaces.py index 522c6a220..d51c199cd 100644 --- a/src/lib/Bcfg2/Server/Plugin/interfaces.py +++ b/src/lib/Bcfg2/Server/Plugin/interfaces.py @@ -343,14 +343,14 @@ class ThreadedStatistics(Statistics, Threaded, threading.Thread): """ ThreadedStatistics plugins process client statistics in a separate thread. """ - def __init__(self, core, datastore): - Statistics.__init__(self, core, datastore) + def __init__(self, core): + Statistics.__init__(self, core) Threaded.__init__(self) threading.Thread.__init__(self) # Event from the core signaling an exit self.terminate = core.terminate self.work_queue = Queue(100000) - self.pending_file = os.path.join(datastore, "etc", + self.pending_file = os.path.join(Bcfg2.Options.setup.repository, "etc", "%s.pending" % self.name) self.daemon = False @@ -565,8 +565,8 @@ class Version(Plugin): __rmi__ = Plugin.__rmi__ + ['get_revision'] - def __init__(self, core, datastore): - Plugin.__init__(self, core, datastore) + def __init__(self, core): + Plugin.__init__(self, core) if self.__vcs_metadata_path__: self.vcs_path = os.path.join(Bcfg2.Options.setup.vcs_root, -- cgit v1.2.3-1-g7c22