feat: impl forge_exists for publiccodeyml

This commit is contained in:
Aravinth Manivannan 2022-06-03 23:10:54 +05:30
parent 0d0f5270fd
commit 8d222d185b
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88

View file

@ -141,6 +141,17 @@ impl Federate for PccFederate {
self.rm_util(&path).await
}
/// check if a forge instance exists
async fn forge_exists(&self, hostname: &str) -> Result<bool, Self::Error> {
let path = self.get_instance_path(hostname, false).await?;
if path.exists() && path.is_dir() {
let instance = path.join(INSTANCE_INFO_FILE);
Ok(instance.exists() && instance.is_file())
} else {
Ok(false)
}
}
/// create user isntance
async fn create_user(&self, f: &AddUser<'_>) -> Result<(), Self::Error> {
let path = self.get_user_path(f.username, f.hostname, true).await?;