summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
diff options
context:
space:
mode:
authorAlexander Sulfrian <asulfrian@zedat.fu-berlin.de>2022-01-22 17:33:30 +0100
committerAlexander Sulfrian <asulfrian@zedat.fu-berlin.de>2022-01-30 05:03:59 +0100
commitbb832783332f17cd78e7a79f8dc7dfcd839c5615 (patch)
tree55267fbb0c577dde42726bdc378bcebf22184d3d /src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
parent134ebc875dd810dd6d1ef069365dea49af7a7bf9 (diff)
downloadbcfg2-bb832783332f17cd78e7a79f8dc7dfcd839c5615.tar.gz
bcfg2-bb832783332f17cd78e7a79f8dc7dfcd839c5615.tar.bz2
bcfg2-bb832783332f17cd78e7a79f8dc7dfcd839c5615.zip
Cfg: Block for FAM events after creating files
After a CfgCreator wrote a file, it should block until the fam events are processed. The newly created files might be required by another Cfg plugin (like CfgPrivateKeyCreator and CfgPublicKeyCreator) and the fam events should be processed before the other plugin is invoked.
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
index dae03144a..44d980967 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
@@ -306,6 +306,8 @@ class CfgCreator(CfgBaseFileMatcher):
.. autoattribute:: Bcfg2.Server.Plugins.Cfg.CfgInfo.__specific__
"""
CfgBaseFileMatcher.__init__(self, fname, None)
+ self.cfg = get_cfg()
+ self.core = self.cfg.core
def create_data(self, entry, metadata):
""" Create new data for the given entry and write it to disk
@@ -391,6 +393,7 @@ class CfgCreator(CfgBaseFileMatcher):
try:
open(fileloc, 'wb').write(data)
+ self.core.block_for_fam_events()
except IOError:
err = sys.exc_info()[1]
raise CfgCreationError("Could not write %s: %s" % (fileloc, err))