Configfile (#559)

Add cdist configuration/config file support.
This commit is contained in:
Darko Poljak 2017-08-30 23:02:17 +02:00 committed by GitHub
commit bdee7273af
11 changed files with 1800 additions and 136 deletions

View file

@ -62,7 +62,8 @@ class Remote(object):
remote_copy,
base_path=None,
quiet_mode=None,
archiving_mode=None):
archiving_mode=None,
configuration=None):
self.target_host = target_host
self._exec = remote_exec
self._copy = remote_copy
@ -73,6 +74,10 @@ class Remote(object):
self.base_path = "/var/lib/cdist"
self.quiet_mode = quiet_mode
self.archiving_mode = archiving_mode
if configuration:
self.configuration = configuration
else:
self.configuration = {}
self.conf_path = os.path.join(self.base_path, "conf")
self.object_path = os.path.join(self.base_path, "object")
@ -235,7 +240,10 @@ class Remote(object):
"""
command = [os.environ.get('CDIST_REMOTE_SHELL', "/bin/sh"), "-e"]
command = [
self.configuration.get('CDIST_REMOTE_SHELL', "/bin/sh"),
"-e"
]
command.append(script)
return self.run(command, env, return_output)