From 73a66e78b049bd5bb63156021408e923109d62de Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Sat, 13 Jun 2020 07:40:03 +0300 Subject: [PATCH] Deal with aborted status in Vagrant --- src/steps/vagrant.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/steps/vagrant.rs b/src/steps/vagrant.rs index c058421a..da3b0417 100644 --- a/src/steps/vagrant.rs +++ b/src/steps/vagrant.rs @@ -15,13 +15,14 @@ enum BoxStatus { PowerOff, Running, Saved, + Aborted, } impl BoxStatus { fn powered_on(self) -> bool { match self { - BoxStatus::PowerOff | BoxStatus::Saved => false, BoxStatus::Running => true, + _ => false, } } } @@ -95,9 +96,9 @@ impl<'a> TemporaryPowerOn<'a> { ctx: &'a ExecutionContext<'a>, ) -> Result { let subcommand = match status { - BoxStatus::PowerOff => "up", + BoxStatus::PowerOff | BoxStatus::Aborted => "up", BoxStatus::Saved => "resume", - _ => unreachable!(), + BoxStatus::Running => unreachable!(), }; println!("Powering on {}", vagrant_box); @@ -118,9 +119,9 @@ impl<'a> TemporaryPowerOn<'a> { impl<'a> Drop for TemporaryPowerOn<'a> { fn drop(&mut self) { let subcommand = match self.status { - BoxStatus::PowerOff => "halt", + BoxStatus::PowerOff | BoxStatus::Aborted => "halt", BoxStatus::Saved => "suspend", - _ => unreachable!(), + BoxStatus::Running => unreachable!(), }; println!("Powering off {}", self.vagrant_box);