diff options
-rw-r--r-- | examples/system/flake.lock | 6 | ||||
-rw-r--r-- | src/main.rs | 61 |
2 files changed, 39 insertions, 28 deletions
diff --git a/examples/system/flake.lock b/examples/system/flake.lock index 8f4ca88..b54c929 100644 --- a/examples/system/flake.lock +++ b/examples/system/flake.lock @@ -71,11 +71,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1592491430, - "narHash": "sha256-7WNpr16iUyjG4caad137nCqxXNTdct202jy05lslZXA=", + "lastModified": 1601994071, + "narHash": "sha256-J1TNrQI3Gb5Yl9b4+O6eh1Zp1ha4YhI7ewsN1M/9x68=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "07299ff81e58e16b282fe602ce5e629854dfd544", + "rev": "6f90e1df4f27326c52b805cfd01fc79a49208e5c", "type": "github" }, "original": { diff --git a/src/main.rs b/src/main.rs index fb3fb66..04d7868 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,6 +51,9 @@ struct Opts { /// Override hostname used for the node #[clap(long)] hostname: Option<String>, + /// Skip pushing step (useful for local testing) + #[clap(short, long)] + skip_push: bool, } #[inline] @@ -235,6 +238,7 @@ async fn run_deploy( data: utils::data::Data, supports_flakes: bool, check_sigs: bool, + skip_push: bool, cmd_overrides: utils::CmdOverrides, ) -> Result<(), Box<dyn std::error::Error>> { match (deploy_flake.node, deploy_flake.profile) { @@ -259,14 +263,16 @@ async fn run_deploy( let deploy_defs = deploy_data.defs(); - utils::push::push_profile( - supports_flakes, - check_sigs, - deploy_flake.repo, - &deploy_data, - &deploy_defs, - ) - .await?; + if !skip_push { + utils::push::push_profile( + supports_flakes, + check_sigs, + deploy_flake.repo, + &deploy_data, + &deploy_defs, + ) + .await?; + } utils::deploy::deploy_profile(&deploy_data, &deploy_defs).await?; } @@ -276,23 +282,7 @@ async fn run_deploy( None => good_panic!("No node was found named `{}`", node_name), }; - push_all_profiles( - node, - node_name, - supports_flakes, - deploy_flake.repo, - &data.generic_settings, - check_sigs, - &cmd_overrides, - ) - .await?; - - deploy_all_profiles(node, node_name, &data.generic_settings, &cmd_overrides).await?; - } - (None, None) => { - info!("Deploying all profiles on all nodes"); - - for (node_name, node) in &data.nodes { + if !skip_push { push_all_profiles( node, node_name, @@ -305,6 +295,26 @@ async fn run_deploy( .await?; } + deploy_all_profiles(node, node_name, &data.generic_settings, &cmd_overrides).await?; + } + (None, None) => { + info!("Deploying all profiles on all nodes"); + + if !skip_push { + for (node_name, node) in &data.nodes { + push_all_profiles( + node, + node_name, + supports_flakes, + deploy_flake.repo, + &data.generic_settings, + check_sigs, + &cmd_overrides, + ) + .await?; + } + } + for (node_name, node) in &data.nodes { deploy_all_profiles(node, node_name, &data.generic_settings, &cmd_overrides) .await?; @@ -363,6 +373,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { data, supports_flakes, opts.checksigs, + opts.skip_push, cmd_overrides, ) .await?; |