ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

[autofix.ci] apply automated fixes

authored by

autofix-ci[bot] and committed by
GitHub
a40a2170 9d52cb63

+38 -22
+4 -1
wire/lib/src/commands/common.rs
··· 38 38 39 39 let child = run_command_with_env( 40 40 &CommandArguments::new(command_string, modifiers, clobber_lock).nix(), 41 - HashMap::from([("NIX_SSHOPTS".into(), node.target.create_ssh_opts(modifiers, false)?)]), 41 + HashMap::from([( 42 + "NIX_SSHOPTS".into(), 43 + node.target.create_ssh_opts(modifiers, false)?, 44 + )]), 42 45 )?; 43 46 44 47 child
+17 -10
wire/lib/src/hive/node.rs
··· 44 44 45 45 impl Target { 46 46 #[instrument(ret(level = tracing::Level::DEBUG), skip_all)] 47 - pub fn create_ssh_opts(&self, modifiers: SubCommandModifiers, master: bool) -> Result<String, HiveLibError> { 47 + pub fn create_ssh_opts( 48 + &self, 49 + modifiers: SubCommandModifiers, 50 + master: bool, 51 + ) -> Result<String, HiveLibError> { 48 52 Ok(self.create_ssh_args(modifiers, false, master)?.join(" ")) 49 53 } 50 54 ··· 53 57 &self, 54 58 modifiers: SubCommandModifiers, 55 59 non_interactive_forced: bool, 56 - master: bool 60 + master: bool, 57 61 ) -> Result<Vec<String>, HiveLibError> { 58 62 let mut vector = vec![ 59 63 "-l".to_string(), ··· 80 84 81 85 if let Some(control_path) = get_control_path() { 82 86 options.extend([ 83 - format!("ControlMaster={}", if master { 84 - "yes" 85 - } else { 86 - "no" 87 - }), format!("ControlPath={control_path}"), format!("ControlPersist={CONTROL_PERSIST}") 87 + format!("ControlMaster={}", if master { "yes" } else { "no" }), 88 + format!("ControlPath={control_path}"), 89 + format!("ControlPersist={CONTROL_PERSIST}"), 88 90 ]); 89 91 } 90 92 ··· 101 103 102 104 match std::fs::create_dir(&control_path) { 103 105 Err(err) if err.kind() != ErrorKind::AlreadyExists => { 104 - error!("not using `ControlMaster`, failed to create path {control_path:?}: {err:?}"); 106 + error!( 107 + "not using `ControlMaster`, failed to create path {control_path:?}: {err:?}" 108 + ); 105 109 return None; 106 110 } 107 111 _ => (), ··· 229 233 &CommandArguments::new(command_string, modifiers, clobber_lock) 230 234 .nix() 231 235 .log_stdout(), 232 - HashMap::from([("NIX_SSHOPTS".into(), self.target.create_ssh_opts(modifiers, true)?)]), 236 + HashMap::from([( 237 + "NIX_SSHOPTS".into(), 238 + self.target.create_ssh_opts(modifiers, true)?, 239 + )]), 233 240 )?; 234 241 235 242 output.wait_till_success().await.map_err(|source| { ··· 315 322 Build, 316 323 PushBuildOutput, 317 324 SwitchToConfiguration, 318 - CleanUp 325 + CleanUp, 319 326 } 320 327 321 328 impl Display for Step {
+16 -10
wire/lib/src/hive/steps/cleanup.rs
··· 1 1 // SPDX-License-Identifier: AGPL-3.0-or-later 2 2 // Copyright 2024-2025 wire Contributors 3 3 4 - use std::{fmt::Display}; 4 + use std::fmt::Display; 5 5 6 6 use tokio::process::Command; 7 7 use tracing::error; 8 8 9 - use crate::{errors::HiveLibError, hive::node::{Context, ExecuteStep}}; 9 + use crate::{ 10 + errors::HiveLibError, 11 + hive::node::{Context, ExecuteStep}, 12 + }; 10 13 11 14 #[derive(PartialEq, Debug)] 12 15 pub(crate) struct CleanUp; ··· 22 25 true 23 26 } 24 27 25 - async fn execute(&self,ctx: &mut Context<'_>) -> Result<(), HiveLibError> { 28 + async fn execute(&self, ctx: &mut Context<'_>) -> Result<(), HiveLibError> { 26 29 let output = Command::new("ssh") 27 - .args(ctx.node.target.create_ssh_args(ctx.modifiers, true, false)?) 28 - .args([ 29 - "-O", 30 - "stop", 31 - ctx.node.target.get_preferred_host()? 32 - ]) 30 + .args( 31 + ctx.node 32 + .target 33 + .create_ssh_args(ctx.modifiers, true, false)?, 34 + ) 35 + .args(["-O", "stop", ctx.node.target.get_preferred_host()?]) 33 36 .output() 34 37 .await; 35 38 ··· 40 43 error!("failed to wind-down ControlMaster with `ssh -O stop`: {err}"); 41 44 } 42 45 Ok(std::process::Output { status, stderr, .. }) if !status.success() => { 43 - error!("failed to wind-down ControlMaster with `ssh -O stop`: {}", String::from_utf8_lossy(&stderr)); 46 + error!( 47 + "failed to wind-down ControlMaster with `ssh -O stop`: {}", 48 + String::from_utf8_lossy(&stderr) 49 + ); 44 50 } 45 51 Ok(_) => {} 46 52 }
+1 -1
wire/lib/src/hive/steps/mod.rs
··· 3 3 4 4 pub mod activate; 5 5 pub mod build; 6 + pub mod cleanup; 6 7 pub mod evaluate; 7 8 pub mod keys; 8 9 pub mod ping; 9 10 pub mod push; 10 - pub mod cleanup;