appmgr: make down for 0.2.9 more resilient

This commit is contained in:
Aiden McClelland
2021-03-01 17:40:54 -07:00
committed by Aiden McClelland
parent 4fcdf5f832
commit cfacbcabd3
2 changed files with 13 additions and 3 deletions

View File

@@ -46,8 +46,18 @@ impl VersionT for Version {
Ok(())
}
async fn down(&self) -> Result<(), Error> {
tokio::fs::remove_file("/etc/nginx/sites-enabled/start9-services.conf").await?;
tokio::fs::remove_file(crate::tor::ETC_NGINX_SERVICES_CONF).await?;
tokio::fs::remove_file("/etc/nginx/sites-enabled/start9-services.conf")
.await
.or_else(|e| match e {
e if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
e => Err(e),
})?;
tokio::fs::remove_file(crate::tor::ETC_NGINX_SERVICES_CONF)
.await
.or_else(|e| match e {
e if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
e => Err(e),
})?;
let svc_exit = std::process::Command::new("service")
.args(&["nginx", "reload"])
.status()?;