user remote_prefix=True now

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-10-06 13:40:46 +02:00
parent eea6a38f33
commit df630e1fdf

View file

@ -38,23 +38,16 @@ class Config:
def __init__(self, target_host, def __init__(self, target_host,
initial_manifest=False, initial_manifest=False,
remote_user="root",
home=None, home=None,
exec_path=sys.argv[0], exec_path=sys.argv[0],
debug=False): debug=False):
self.target_host = target_host self.target_host = target_host
self.debug = debug self.debug = debug
self.remote_user = remote_user
self.exec_path = exec_path self.exec_path = exec_path
# FIXME: broken - construct elsewhere!
self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host]
self.path = cdist.path.Path(self.target_host, self.path = cdist.path.Path(self.target_host,
initial_manifest=initial_manifest, initial_manifest=initial_manifest,
remote_user=self.remote_user,
remote_prefix=self.remote_prefix,
base_dir=home, base_dir=home,
debug=debug) debug=debug)
@ -78,7 +71,7 @@ class Config:
cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR)
cmd.append(self.path.remote_global_explorer_path(explorer)) cmd.append(self.path.remote_global_explorer_path(explorer))
cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=self.remote_prefix) cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True)
output_fd.close() output_fd.close()
def run_type_explorer(self, cdist_object): def run_type_explorer(self, cdist_object):
@ -105,7 +98,7 @@ class Config:
log.debug("%s exploring %s using %s storing to %s", log.debug("%s exploring %s using %s storing to %s",
cdist_object, explorer, remote_cmd, output) cdist_object, explorer, remote_cmd, output)
cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True)
output_fd.close() output_fd.close()
def link_emulator(self): def link_emulator(self):
@ -235,8 +228,7 @@ class Config:
remote_remote_code = os.path.join(remote_dir, "code-remote") remote_remote_code = os.path.join(remote_dir, "code-remote")
if os.path.isfile(local_remote_code): if os.path.isfile(local_remote_code):
self.path.transfer_file(local_remote_code, remote_remote_code) self.path.transfer_file(local_remote_code, remote_remote_code)
# FIXME: remote_prefix cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True)
cdist.exec.run_or_fail([remote_remote_code], remote_prefix=self.remote_prefix)
def stage_prepare(self): def stage_prepare(self):
"""Do everything for a deploy, minus the actual code stage""" """Do everything for a deploy, minus the actual code stage"""
@ -297,8 +289,8 @@ def config(args):
time_start = datetime.datetime.now() time_start = datetime.datetime.now()
os.environ['__remote_exec'] = ["ssh", "-o", "User=root" ] os.environ['__remote_exec'] = "ssh -o User=root"
os.environ['__remote_copy'] = ["scp", "-o", "User=root" ] os.environ['__remote_copy'] = "scp -o User=root"
for host in args.host: for host in args.host:
c = Config(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) c = Config(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug)