Add ability to set puppet Exec timeout and to do a "dry run"
This patch allows setting "global" settings in puppet templates and implements the "timeout" global setting for controlling the timeout for puppet's Exec resource. In addition, a "dry run" setting that generates manifests for development purposes but doesn't actually apply them, is added. Change-Id: I5a845a6569aec7188093abfdf354e46fee8c274c
This commit is contained in:
@@ -39,6 +39,7 @@ class ManifestFiles(object):
|
||||
def __init__(self):
|
||||
self.filelist = []
|
||||
self.data = {}
|
||||
self.global_data = None
|
||||
|
||||
# continuous manifest file that have the same marker can be
|
||||
# installed in parallel, if on different servers
|
||||
@@ -58,12 +59,15 @@ class ManifestFiles(object):
|
||||
Write out the manifest data to disk, this should only be called once
|
||||
write before the puppet manifests are copied to the various servers
|
||||
"""
|
||||
if not self.global_data:
|
||||
with open(os.path.join(PUPPET_TEMPLATE_DIR, "global.pp")) as gfp:
|
||||
self.global_data = gfp.read() % controller.CONF
|
||||
os.mkdir(basedefs.PUPPET_MANIFEST_DIR, 0700)
|
||||
for fname, data in self.data.items():
|
||||
path = os.path.join(basedefs.PUPPET_MANIFEST_DIR, fname)
|
||||
fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0600)
|
||||
with os.fdopen(fd, 'w') as fp:
|
||||
fp.write(data)
|
||||
fp.write(self.global_data + data)
|
||||
manifestfiles = ManifestFiles()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user