forked from ungleich-public/cdist
accept exec_path, setup__target_host
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
9ce31fa84a
commit
c81a2925b8
2 changed files with 13 additions and 6 deletions
|
@ -38,13 +38,21 @@ CODE_HEADER = "#!/bin/sh -e\n"
|
|||
class ConfigInstall:
|
||||
"""Cdist main class to hold arbitrary data"""
|
||||
|
||||
def __init__(self, target_host,
|
||||
initial_manifest=False, base_path=False, debug=False):
|
||||
def __init__(self,
|
||||
target_host,
|
||||
initial_manifest=False,
|
||||
base_path=False,
|
||||
exec_path=sys.argv[0],
|
||||
debug=False):
|
||||
|
||||
self.target_host = target_host
|
||||
# FIXME: should this be setup here?
|
||||
os.environ['__target_host'] = self.target_host
|
||||
|
||||
self.debug = debug
|
||||
self.exec_path = sys.argv[0]
|
||||
|
||||
# Required for testing
|
||||
self.exec_path = exec_path
|
||||
|
||||
# Base and Temp Base
|
||||
if base_path:
|
||||
|
@ -55,7 +63,6 @@ class ConfigInstall:
|
|||
os.pardir,
|
||||
os.pardir))
|
||||
|
||||
|
||||
# Local input
|
||||
self.cache_path = os.path.join(self.base_path, "cache",
|
||||
self.target_host)
|
||||
|
|
|
@ -34,7 +34,7 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs):
|
|||
|
||||
if remote_prefix:
|
||||
remote_prefix = os.environ['__remote_exec'].split()
|
||||
remote_prefix.append(os.environ['target_host'])
|
||||
remote_prefix.append(os.environ['__target_host'])
|
||||
args[0][:0] = remote_prefix
|
||||
|
||||
log.debug("Shell exec cmd: %s", args)
|
||||
|
@ -65,7 +65,7 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs):
|
|||
def run_or_fail(*args, remote_prefix=False, **kargs):
|
||||
if remote_prefix:
|
||||
remote_prefix = os.environ['__remote_exec'].split()
|
||||
remote_prefix.append(os.environ['target_host'])
|
||||
remote_prefix.append(os.environ['__target_host'])
|
||||
args[0][:0] = remote_prefix
|
||||
|
||||
log.debug("Exec: " + " ".join(*args))
|
||||
|
|
Loading…
Reference in a new issue