parent
4b2f23db62
commit
bdee7273af
11 changed files with 1800 additions and 136 deletions
|
|
@ -55,7 +55,8 @@ class Local(object):
|
|||
initial_manifest=None,
|
||||
add_conf_dirs=None,
|
||||
cache_path_pattern=None,
|
||||
quiet_mode=False):
|
||||
quiet_mode=False,
|
||||
configuration=None):
|
||||
|
||||
self.target_host = target_host
|
||||
if target_host_tags is None:
|
||||
|
|
@ -70,6 +71,10 @@ class Local(object):
|
|||
self._add_conf_dirs = add_conf_dirs
|
||||
self.cache_path_pattern = cache_path_pattern
|
||||
self.quiet_mode = quiet_mode
|
||||
if configuration:
|
||||
self.configuration = configuration
|
||||
else:
|
||||
self.configuration = {}
|
||||
|
||||
self._init_log()
|
||||
self._init_permissions()
|
||||
|
|
@ -142,10 +147,12 @@ class Local(object):
|
|||
self.conf_dirs.append(self.home_dir)
|
||||
|
||||
# Add directories defined in the CDIST_PATH environment variable
|
||||
if 'CDIST_PATH' in os.environ:
|
||||
cdist_path_dirs = re.split(r'(?<!\\):', os.environ['CDIST_PATH'])
|
||||
cdist_path_dirs.reverse()
|
||||
self.conf_dirs.extend(cdist_path_dirs)
|
||||
# if 'CDIST_PATH' in os.environ:
|
||||
# cdist_path_dirs = re.split(r'(?<!\\):', os.environ['CDIST_PATH'])
|
||||
# cdist_path_dirs.reverse()
|
||||
# self.conf_dirs.extend(cdist_path_dirs)
|
||||
if 'conf_dir' in self.configuration:
|
||||
self.conf_dirs.extend(self.configuration['conf_dir'])
|
||||
|
||||
# Add command line supplied directories
|
||||
if self._add_conf_dirs:
|
||||
|
|
@ -175,12 +182,11 @@ class Local(object):
|
|||
def _init_cache_dir(self, cache_dir):
|
||||
if cache_dir:
|
||||
self.cache_path = cache_dir
|
||||
elif self.home_dir:
|
||||
self.cache_path = os.path.join(self.home_dir, "cache")
|
||||
else:
|
||||
if self.home_dir:
|
||||
self.cache_path = os.path.join(self.home_dir, "cache")
|
||||
else:
|
||||
raise cdist.Error(
|
||||
"No homedir setup and no cache dir location given")
|
||||
raise cdist.Error(
|
||||
"No homedir setup and no cache dir location given")
|
||||
|
||||
def rmdir(self, path):
|
||||
"""Remove directory on the local side."""
|
||||
|
|
@ -258,7 +264,7 @@ class Local(object):
|
|||
self.log.debug('%s is executable, running it', script)
|
||||
command = [script]
|
||||
else:
|
||||
command = [os.environ.get('CDIST_LOCAL_SHELL', "/bin/sh"), "-e"]
|
||||
command = [self.configuration.get('local_shell', "/bin/sh"), "-e"]
|
||||
self.log.debug('%s is NOT executable, running it with %s',
|
||||
script, " ".join(command))
|
||||
command.append(script)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue