aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bantyev2020-11-26 18:42:31 +0300
committernotgne22020-12-02 10:24:23 -0700
commit10194ad529ee41f9a6847860178ea105b72faec5 (patch)
tree1530d7ae48046fa748c940ad1985c206ea2b10b6
parentc1e0f5a9c9f6402703aece1581fd00ab20f71ded (diff)
Fail early if there is no activation script in profile path
-rw-r--r--src/utils/push.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/utils/push.rs b/src/utils/push.rs
index 76e87c9..b0a8b2f 100644
--- a/src/utils/push.rs
+++ b/src/utils/push.rs
@@ -4,6 +4,7 @@
use std::process::Stdio;
use tokio::process::Command;
+use std::path::Path;
use thiserror::Error;
@@ -15,6 +16,12 @@ pub enum PushProfileError {
BuildError(std::io::Error),
#[error("Nix build command resulted in a bad exit code: {0:?}")]
BuildExitError(Option<i32>),
+ #[error("Activation script deploy-rs-activate does not exist in profile.\n\
+ Did you forget to use deploy-rs#lib.<...>.activate.<...> on your profile path?")]
+ DeployRsActivateDoesntExist,
+ #[error("Activation script activate-rs does not exist in profile.\n\
+ Is there a mismatch in deploy-rs used in the flake you're deploying and deploy-rs command you're running?")]
+ ActivateRsDoesntExist,
#[error("Failed to run Nix sign command: {0}")]
SignError(std::io::Error),
#[error("Nix sign command resulted in a bad exit code: {0:?}")]
@@ -87,6 +94,16 @@ pub async fn push_profile(
a => return Err(PushProfileError::BuildExitError(a)),
};
+ if ! Path::new(format!("{}/deploy-rs-activate", deploy_data.profile.profile_settings.path).as_str()).exists() {
+ return Err(PushProfileError::DeployRsActivateDoesntExist);
+ }
+
+ if ! Path::new(format!("{}/activate-rs", deploy_data.profile.profile_settings.path).as_str()).exists() {
+ return Err(PushProfileError::ActivateRsDoesntExist);
+ }
+
+
+
if let Ok(local_key) = std::env::var("LOCAL_KEY") {
info!(
"Signing key present! Signing profile `{}` for node `{}`",