From 3a92593bf9c4ca07a2b09888e4a3f7dff6c9c510 Mon Sep 17 00:00:00 2001 From: notgne2 Date: Tue, 6 Oct 2020 11:08:40 -0700 Subject: Add skip-push flag --- src/main.rs | 61 ++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 25 deletions(-) (limited to 'src') 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, + /// 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> { 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> { data, supports_flakes, opts.checksigs, + opts.skip_push, cmd_overrides, ) .await?; -- cgit v1.2.3