forked from ungleich-public/cdist
allow manifest to return env for usage from external
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
28bf0c3ed8
commit
6482863c5d
1 changed files with 21 additions and 13 deletions
|
@ -78,21 +78,23 @@ class Manifest(object):
|
|||
self.env.update({'__cdist_debug': "yes" })
|
||||
|
||||
|
||||
def run_initial_manifest(self, script):
|
||||
def env_initial_manifest(self, script):
|
||||
env = os.environ.copy()
|
||||
env.update(self.env)
|
||||
env['__manifest'] = self.local.manifest_path
|
||||
env['__cdist_manifest'] = script
|
||||
|
||||
return env
|
||||
|
||||
def run_initial_manifest(self, script):
|
||||
self.log.info("Running initial manifest " + self.local.manifest_path)
|
||||
|
||||
if not os.path.isfile(self.local.manifest_path):
|
||||
raise cdist.Error("Initial manifest is missing")
|
||||
|
||||
self.local.run_script(script, env=env)
|
||||
self.local.run_script(script, env=self.env_initial_manifest(script))
|
||||
|
||||
def run_type_manifest(self, cdist_object):
|
||||
script = os.path.join(self.local.type_path, cdist_object.cdist_type.manifest_path)
|
||||
if os.path.isfile(script):
|
||||
def env_type_manifest(self, cdist_object):
|
||||
env = os.environ.copy()
|
||||
env.update(self.env)
|
||||
env.update({
|
||||
|
@ -103,4 +105,10 @@ class Manifest(object):
|
|||
'__type': cdist_object.cdist_type.absolute_path,
|
||||
'__cdist_manifest': script,
|
||||
})
|
||||
self.local.run_script(script, env=env)
|
||||
|
||||
return env
|
||||
|
||||
def run_type_manifest(self, cdist_object):
|
||||
script = os.path.join(self.local.type_path, cdist_object.cdist_type.manifest_path)
|
||||
if os.path.isfile(script):
|
||||
self.local.run_script(script, env=self.env_type_manifest(cdist_object))
|
||||
|
|
Loading…
Reference in a new issue