Add cdist info command

This commit is contained in:
Darko Poljak 2019-12-30 09:32:15 +01:00
commit e4596593c0
5 changed files with 283 additions and 36 deletions

View file

@ -175,3 +175,28 @@ def log_std_fd(log, command, stdfd, prefix):
stdfd.seek(0, 0)
log.trace("Command: {}; {}: {}".format(
command, prefix, stdfd.read().decode()))
def dist_conf_dir():
return os.path.abspath(os.path.join(os.path.dirname(cdist.__file__),
"conf"))
def resolve_conf_dirs(configuration, add_conf_dirs):
conf_dirs = []
conf_dirs.append(dist_conf_dir())
home_dir = cdist.home_dir()
if home_dir:
conf_dirs.append(home_dir)
if 'conf_dir' in configuration:
x = configuration['conf_dir']
if x:
conf_dirs.extend(x)
if add_conf_dirs:
conf_dirs.extend(add_conf_dirs)
conf_dirs = set(conf_dirs)
return conf_dirs