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

@@ -299,7 +299,7 @@ pub async fn write_lan_services(hidden_services: &ServicesMap) -> Result<(), Err
.arg(&req_path)
.arg("-out")
.arg(&cert_path)
.invoke("OpenSSL GenKey")
.invoke("OpenSSL CA")
.await?;
}
let fullchain_path = base_path.join("cert-local.fullchain.crt.pem");

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()?;