aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs73
1 files changed, 37 insertions, 36 deletions
diff --git a/src/main.rs b/src/main.rs
index b28a520..cedf684 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -51,9 +51,15 @@ 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,
+ /// Make activation wait for confirmation, or roll back after a period of time
+ #[clap(long)]
+ magic_rollback: Option<bool>,
+ /// How long activation should wait for confirmation (if using magic-rollback)
+ #[clap(long)]
+ confirm_timeout: Option<u16>,
+ /// Where to store temporary files (only used by magic-rollback)
+ #[clap(long)]
+ temp_path: Option<String>,
}
#[inline]
@@ -238,7 +244,6 @@ 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) {
@@ -263,16 +268,14 @@ async fn run_deploy(
let deploy_defs = deploy_data.defs();
- if !skip_push {
- utils::push::push_profile(
- supports_flakes,
- check_sigs,
- deploy_flake.repo,
- &deploy_data,
- &deploy_defs,
- )
- .await?;
- }
+ 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?;
}
@@ -282,7 +285,23 @@ async fn run_deploy(
None => good_panic!("No node was found named `{}`", node_name),
};
- if !skip_push {
+ 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 {
push_all_profiles(
node,
node_name,
@@ -295,26 +314,6 @@ 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?;
@@ -347,6 +346,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
fast_connection: opts.fast_connection,
auto_rollback: opts.auto_rollback,
hostname: opts.hostname,
+ magic_rollback: opts.magic_rollback,
+ temp_path: opts.temp_path,
+ confirm_timeout: opts.confirm_timeout,
};
let supports_flakes = test_flake_support().await?;
@@ -359,7 +361,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
data,
supports_flakes,
opts.checksigs,
- opts.skip_push,
cmd_overrides,
)
.await?;