summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Packages/PackagesConfig.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2011-12-30 09:50:05 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2011-12-30 09:50:05 -0500
commit5fc3effb174ff6e9fbfd05346134ac8861477884 (patch)
tree2772e81b9447d2d85247f2aeb5491fe32b48644b /src/lib/Server/Plugins/Packages/PackagesConfig.py
parent6a9e492eaaca81609e7dd149a660bb24e119572c (diff)
downloadbcfg2-5fc3effb174ff6e9fbfd05346134ac8861477884.tar.gz
bcfg2-5fc3effb174ff6e9fbfd05346134ac8861477884.tar.bz2
bcfg2-5fc3effb174ff6e9fbfd05346134ac8861477884.zip
added SimpleConfig plugin for easy config files; made Packages and Rules use SimpleConfig; made regex in rules off by default, but configurable in rules.conf
Diffstat (limited to 'src/lib/Server/Plugins/Packages/PackagesConfig.py')
-rw-r--r--src/lib/Server/Plugins/Packages/PackagesConfig.py31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/lib/Server/Plugins/Packages/PackagesConfig.py b/src/lib/Server/Plugins/Packages/PackagesConfig.py
index d3732bf96..dd39bb495 100644
--- a/src/lib/Server/Plugins/Packages/PackagesConfig.py
+++ b/src/lib/Server/Plugins/Packages/PackagesConfig.py
@@ -1,33 +1,18 @@
-import os
import logging
-from Bcfg2.Bcfg2Py3k import ConfigParser
-from Bcfg2.Server.Plugins.Packages import *
+import Bcfg2.Server.Plugin
logger = logging.getLogger('Packages')
-class PackagesConfig(Bcfg2.Server.Plugin.FileBacked,
- ConfigParser.SafeConfigParser):
- def __init__(self, filename, fam, packages):
- Bcfg2.Server.Plugin.FileBacked.__init__(self, filename)
- ConfigParser.SafeConfigParser.__init__(self)
-
- self.fam = fam
- # packages.conf isn't strictly necessary, so only set a
- # monitor if it exists. if it gets added, that will require a
- # server restart
- if os.path.exists(self.name):
- self.fam.AddMonitor(self.name, self)
-
- self.pkg_obj = packages
-
+class PackagesConfig(Bcfg2.Server.Plugin.SimpleConfig):
+ _required = False
+
def Index(self):
""" Build local data structures """
- for section in self.sections():
- self.remove_section(section)
- self.read(self.name)
- if self.pkg_obj.sources.loaded:
+ Bcfg2.Server.Plugin.SimpleConfig.Index(self)
+
+ if self.plugin.sources.loaded:
# only reload Packages plugin if sources have been loaded.
# otherwise, this is getting called on server startup, and
# we have to wait until all sources have been indexed
# before we can call Packages.Reload()
- self.pkg_obj.Reload()
+ self.plugin.Reload()