aboutsummaryrefslogtreecommitdiff
path: root/src/deploy.rs
diff options
context:
space:
mode:
authornotgne22021-01-28 19:49:14 -0700
committernotgne22021-02-09 02:55:26 -0700
commit4ff0e5f90bb297ed73686bc13d4cfe93a5d2e7e8 (patch)
treed24cb6765cc40154c01f2a4191751b8d8d823d55 /src/deploy.rs
parent96a268db2dceb6b6c63d3fa2d47e2c188a1b11f4 (diff)
Wait for `ssh_activate` to complete and check for errors in magic_rollback activation (fixes #58 and #49)
Diffstat (limited to 'src/deploy.rs')
-rw-r--r--src/deploy.rs31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/deploy.rs b/src/deploy.rs
index 686c7b7..88becc0 100644
--- a/src/deploy.rs
+++ b/src/deploy.rs
@@ -246,16 +246,25 @@ pub async fn deploy_profile(
ssh_wait_command.arg(ssh_opt);
}
- let ssh_wait_exit_status = ssh_wait_command
- .arg(self_wait_command)
- .status()
- .await
- .map_err(DeployProfileError::SSHWaitError)?;
+ tokio::pin! {
+ let ssh_wait_future = ssh_wait_command.arg(self_wait_command).status();
+ let ssh_activate_future = ssh_activate.wait_with_output();
+ }
- match ssh_wait_exit_status.code() {
- Some(0) => (),
- a => return Err(DeployProfileError::SSHWaitExitError(a)),
- };
+ tokio::select! {
+ x = ssh_wait_future => {
+ match x.map_err(DeployProfileError::SSHWaitError)?.code() {
+ Some(0) => (),
+ a => return Err(DeployProfileError::SSHWaitExitError(a)),
+ };
+ },
+ x = ssh_activate_future => {
+ match x.map_err(DeployProfileError::SSHActivateError)?.status.code() {
+ Some(0) => (),
+ a => return Err(DeployProfileError::SSHActivateExitError(a)),
+ };
+ },
+ }
info!("Success activating, attempting to confirm activation");
@@ -279,13 +288,13 @@ pub async fn deploy_profile(
confirm_command
);
- let ssh_exit_status = ssh_confirm_command
+ let ssh_confirm_exit_status = ssh_confirm_command
.arg(confirm_command)
.status()
.await
.map_err(DeployProfileError::SSHConfirmError)?;
- match ssh_exit_status.code() {
+ match ssh_confirm_exit_status.code() {
Some(0) => (),
a => return Err(DeployProfileError::SSHConfirmExitError(a)),
};