mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-25 16:17:56 +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<()> {
|
||||
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);
|
||||
return Ok(())
|
||||
} else {
|
||||
@ -140,8 +144,16 @@ impl PermissionsProvider {
|
||||
}
|
||||
path.pop();
|
||||
|
||||
|
||||
// ====================: 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);
|
||||
return Ok(())
|
||||
} else {
|
||||
@ -153,8 +165,16 @@ impl PermissionsProvider {
|
||||
}
|
||||
path.pop();
|
||||
|
||||
|
||||
// ====================: 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);
|
||||
return Ok(())
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user