Execution context
This commit is contained in:
@@ -98,11 +98,8 @@ fn run() -> Result<()> {
|
|||||||
for remote_topgrade in topgrades {
|
for remote_topgrade in topgrades {
|
||||||
runner.execute(remote_topgrade, || {
|
runner.execute(remote_topgrade, || {
|
||||||
generic::run_remote_topgrade(
|
generic::run_remote_topgrade(
|
||||||
run_type,
|
&ctx,
|
||||||
remote_topgrade,
|
remote_topgrade,
|
||||||
config.ssh_arguments(),
|
|
||||||
config.run_in_tmux(),
|
|
||||||
config.tmux_arguments(),
|
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,18 +198,15 @@ pub fn run_composer_update(base_dirs: &BaseDirs, run_type: RunType) -> Result<()
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_remote_topgrade(
|
pub fn run_remote_topgrade(
|
||||||
run_type: RunType,
|
ctx: &ExecutionContext,
|
||||||
hostname: &str,
|
hostname: &str,
|
||||||
ssh_arguments: &Option<String>,
|
|
||||||
run_in_tmux: bool,
|
|
||||||
_tmux_arguments: &Option<String>,
|
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let ssh = utils::require("ssh")?;
|
let ssh = utils::require("ssh")?;
|
||||||
|
|
||||||
if run_in_tmux && !run_type.dry() {
|
if ctx.config().run_in_tmux() && !ctx.run_type().dry() {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
crate::tmux::run_remote_topgrade(hostname, &ssh, _tmux_arguments)?;
|
crate::tmux::run_remote_topgrade(hostname, &ssh, ctx.config().tmux_arguments())?;
|
||||||
Err(SkipStep.into())
|
Err(SkipStep.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,13 +215,13 @@ pub fn run_remote_topgrade(
|
|||||||
} else {
|
} else {
|
||||||
let mut args = vec!["-t", hostname];
|
let mut args = vec!["-t", hostname];
|
||||||
|
|
||||||
if let Some(ssh_arguments) = ssh_arguments {
|
if let Some(ssh_arguments) = ctx.config().ssh_arguments() {
|
||||||
args.extend(ssh_arguments.split_whitespace());
|
args.extend(ssh_arguments.split_whitespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
let env = format!("TOPGRADE_PREFIX={}", hostname);
|
let env = format!("TOPGRADE_PREFIX={}", hostname);
|
||||||
args.extend(&["env", &env, "topgrade"]);
|
args.extend(&["env", &env, "topgrade"]);
|
||||||
|
|
||||||
run_type.execute(&ssh).args(&args).check_run()
|
ctx.run_type().execute(&ssh).args(&args).check_run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user