aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotgne22021-02-06 18:01:43 -0700
committernotgne22021-02-09 02:55:26 -0700
commitb74bb50a15b3b94d6c7138a8ca40aedc92de5f69 (patch)
treede931b05876dc2d264e72ee287a15e962523a0c8 /src
parente798bb7d834cd786a49041a61c1a222ecdc96483 (diff)
Clean up structure used for activation command error sending
Diffstat (limited to 'src')
-rw-r--r--src/deploy.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/deploy.rs b/src/deploy.rs
index aba41f2..62c97d0 100644
--- a/src/deploy.rs
+++ b/src/deploy.rs
@@ -299,16 +299,18 @@ pub async fn deploy_profile(
tokio::spawn(async move {
let o = ssh_activate.wait_with_output().await;
- // Don't event unless somethis is bad
- // TODO: maybe replace the structure with our own
- match o {
+ let maybe_err = match o {
+ Err(x) => Some(DeployProfileError::SSHActivateError(x)),
Ok(ref x) => match x.status.code() {
- Some(0) => (),
- _ => send_activate.send(o).unwrap(),
+ Some(0) => None,
+ a => Some(DeployProfileError::SSHActivateExitError(a)),
},
- _ => send_activate.send(o).unwrap(),
};
+ if let Some(err) = maybe_err {
+ send_activate.send(err).unwrap();
+ }
+
send_activated.send(()).unwrap();
});
@@ -321,11 +323,7 @@ pub async fn deploy_profile(
};
},
x = recv_activate => {
- debug!("Activate command exited with an error");
- match x.unwrap().map_err(DeployProfileError::SSHActivateError)?.status.code() {
- Some(0) => unreachable!(), // We know it is an error, see a comment above
- a => return Err(DeployProfileError::SSHActivateExitError(a)),
- };
+ return Err(x.unwrap());
},
}