refactor: move RunType::execute to ExecutionContext

This commit is contained in:
Andre Toerien
2025-06-24 15:20:29 +02:00
committed by Gideon
parent 257d202646
commit 32197f79f3
27 changed files with 386 additions and 621 deletions

View File

@@ -114,8 +114,7 @@ impl<'a> TemporaryPowerOn<'a> {
BoxStatus::Running => unreachable!(),
};
ctx.run_type()
.execute(vagrant)
ctx.execute(vagrant)
.args([subcommand, &vagrant_box.name])
.current_dir(vagrant_box.path.clone())
.status_checked()?;
@@ -141,7 +140,6 @@ impl Drop for TemporaryPowerOn<'_> {
println!();
self.ctx
.run_type()
.execute(self.vagrant)
.args([subcommand, &self.vagrant_box.name])
.current_dir(self.vagrant_box.path.clone())
@@ -202,8 +200,7 @@ pub fn topgrade_vagrant_box(ctx: &ExecutionContext, vagrant_box: &VagrantBox) ->
command.push_str(" -y");
}
ctx.run_type()
.execute(&vagrant.path)
ctx.execute(&vagrant.path)
.current_dir(&vagrant_box.path)
.args(["ssh", "-c", &command])
.status_checked()
@@ -223,7 +220,6 @@ pub fn upgrade_vagrant_boxes(ctx: &ExecutionContext) -> Result<()> {
for ele in re.captures_iter(&outdated.stdout) {
found = true;
let _ = ctx
.run_type()
.execute(&vagrant)
.args(["box", "update", "--box"])
.arg(ele.get(1).unwrap().as_str())
@@ -235,10 +231,7 @@ pub fn upgrade_vagrant_boxes(ctx: &ExecutionContext) -> Result<()> {
if !found {
println!("{}", t!("No outdated boxes"));
} else {
ctx.run_type()
.execute(&vagrant)
.args(["box", "prune"])
.status_checked()?;
ctx.execute(&vagrant).args(["box", "prune"]).status_checked()?;
}
Ok(())