summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Admin
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-04-16 09:42:31 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-04-16 09:56:36 -0400
commit0395e9b832e2f436d8b678ab18890f0593c52d53 (patch)
treeddf1208944f6f60e7de04ea218481eb2208b3e9e /src/lib/Bcfg2/Server/Admin
parent8f00b76e2d1931611f84e5da99ffa204895896f9 (diff)
downloadbcfg2-0395e9b832e2f436d8b678ab18890f0593c52d53.tar.gz
bcfg2-0395e9b832e2f436d8b678ab18890f0593c52d53.tar.bz2
bcfg2-0395e9b832e2f436d8b678ab18890f0593c52d53.zip
Core: load plugins after daemonization so files/dirs created at plugin init time have proper permissions
Diffstat (limited to 'src/lib/Bcfg2/Server/Admin')
-rw-r--r--src/lib/Bcfg2/Server/Admin/Minestruct.py3
-rw-r--r--src/lib/Bcfg2/Server/Admin/Pull.py10
2 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/Bcfg2/Server/Admin/Minestruct.py b/src/lib/Bcfg2/Server/Admin/Minestruct.py
index 13c0563ec..93e42305c 100644
--- a/src/lib/Bcfg2/Server/Admin/Minestruct.py
+++ b/src/lib/Bcfg2/Server/Admin/Minestruct.py
@@ -3,6 +3,7 @@ import getopt
import lxml.etree
import sys
import Bcfg2.Server.Admin
+from Bcfg2.Server.Plugin import PullSource
class Minestruct(Bcfg2.Server.Admin.StructureMode):
@@ -39,7 +40,7 @@ class Minestruct(Bcfg2.Server.Admin.StructureMode):
try:
extra = set()
- for source in self.bcore.pull_sources:
+ for source in self.bcore.plugins_by_type(PullSource):
for item in source.GetExtra(client):
extra.add(item)
except:
diff --git a/src/lib/Bcfg2/Server/Admin/Pull.py b/src/lib/Bcfg2/Server/Admin/Pull.py
index 9f1b3d138..8001425df 100644
--- a/src/lib/Bcfg2/Server/Admin/Pull.py
+++ b/src/lib/Bcfg2/Server/Admin/Pull.py
@@ -6,6 +6,7 @@ import sys
import getopt
import select
import Bcfg2.Server.Admin
+from Bcfg2.Server.Plugin import PullSource, Generator
from Bcfg2.Compat import input # pylint: disable=W0622
@@ -62,13 +63,14 @@ class Pull(Bcfg2.Server.Admin.MetadataCore):
given client/entry from statistics.
"""
new_entry = {'type': etype, 'name': ename}
- for plugin in self.bcore.pull_sources:
+ pull_sources = self.bcore.plugins_by_type(PullSource)
+ for plugin in pull_sources:
try:
(owner, group, mode, contents) = \
plugin.GetCurrentEntry(client, etype, ename)
break
except Bcfg2.Server.Plugin.PluginExecutionError:
- if plugin == self.bcore.pull_sources[-1]:
+ if plugin == pull_sources[-1]:
print("Pull Source failure; could not fetch current state")
raise SystemExit(1)
@@ -121,8 +123,8 @@ class Pull(Bcfg2.Server.Admin.MetadataCore):
meta = self.bcore.build_metadata(client)
# Find appropriate plugin in bcore
- glist = [gen for gen in self.bcore.generators if
- ename in gen.Entries.get(etype, {})]
+ glist = [gen for gen in self.bcore.plugins_by_type(Generator)
+ if ename in gen.Entries.get(etype, {})]
if len(glist) != 1:
self.errExit("Got wrong numbers of matching generators for entry:"
"%s" % ([g.name for g in glist]))