Can delete a pending device
This commit is contained in:
@ -95,4 +95,27 @@ impl DevicesList {
|
||||
pub fn full_list(&self) -> Vec<Device> {
|
||||
self.0.clone().into_values().collect()
|
||||
}
|
||||
|
||||
/// Delete a device
|
||||
pub fn delete(&mut self, id: &DeviceId) -> anyhow::Result<()> {
|
||||
let crt_path = AppConfig::get().device_cert_path(id);
|
||||
if crt_path.is_file() {
|
||||
// TODO : implement
|
||||
unimplemented!("Certificate revocation not implemented yet!");
|
||||
}
|
||||
|
||||
let csr_path = AppConfig::get().device_csr_path(id);
|
||||
if csr_path.is_file() {
|
||||
std::fs::remove_file(&csr_path)?;
|
||||
}
|
||||
|
||||
let conf_path = AppConfig::get().device_config_path(id);
|
||||
if conf_path.is_file() {
|
||||
std::fs::remove_file(&conf_path)?;
|
||||
}
|
||||
|
||||
self.0.remove(id);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user