mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-10 17:43:23 +01:00
Don't fail if the dump directories already exist
e.g. because of a previous dump
This commit is contained in:
parent
d4ed885dc7
commit
eb4e164c79
@ -128,7 +128,11 @@ impl PermissionsProvider {
|
|||||||
|
|
||||||
pub fn dump_db<T: Transaction>(&mut self, txn: &T, mut path: PathBuf) -> Result<()> {
|
pub fn dump_db<T: Transaction>(&mut self, txn: &T, mut path: PathBuf) -> Result<()> {
|
||||||
path.push("roles");
|
path.push("roles");
|
||||||
if let Err(e) = fs::create_dir(&path) {
|
let mut k = Ok(());
|
||||||
|
if !path.is_dir() {
|
||||||
|
k = fs::create_dir(&path);
|
||||||
|
}
|
||||||
|
if let Err(e) = k {
|
||||||
error!(self.log, "Failed to create 'roles' directory: {}, skipping!", e);
|
error!(self.log, "Failed to create 'roles' directory: {}, skipping!", e);
|
||||||
return Ok(())
|
return Ok(())
|
||||||
} else {
|
} else {
|
||||||
@ -140,8 +144,16 @@ impl PermissionsProvider {
|
|||||||
}
|
}
|
||||||
path.pop();
|
path.pop();
|
||||||
|
|
||||||
|
|
||||||
|
// ====================: PERMS :====================
|
||||||
|
|
||||||
|
|
||||||
path.push("perms");
|
path.push("perms");
|
||||||
if let Err(e) = fs::create_dir(&path) {
|
let mut k = Ok(());
|
||||||
|
if !path.is_dir() {
|
||||||
|
k = fs::create_dir(&path);
|
||||||
|
}
|
||||||
|
if let Err(e) = k {
|
||||||
error!(self.log, "Failed to create 'perms' directory: {}, skipping!", e);
|
error!(self.log, "Failed to create 'perms' directory: {}, skipping!", e);
|
||||||
return Ok(())
|
return Ok(())
|
||||||
} else {
|
} else {
|
||||||
@ -153,8 +165,16 @@ impl PermissionsProvider {
|
|||||||
}
|
}
|
||||||
path.pop();
|
path.pop();
|
||||||
|
|
||||||
|
|
||||||
|
// ====================: USERS :====================
|
||||||
|
|
||||||
|
|
||||||
path.push("users");
|
path.push("users");
|
||||||
if let Err(e) = fs::create_dir(&path) {
|
let mut k = Ok(());
|
||||||
|
if !path.is_dir() {
|
||||||
|
k = fs::create_dir(&path);
|
||||||
|
}
|
||||||
|
if let Err(e) = k {
|
||||||
error!(self.log, "Failed to create 'users' directory: {}, skipping!", e);
|
error!(self.log, "Failed to create 'users' directory: {}, skipping!", e);
|
||||||
return Ok(())
|
return Ok(())
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user