src/backup/chunk_store.rs - create: pass User instead of CreateOptions
This commit is contained in:
parent
bca9093520
commit
e67770d496
@ -5,7 +5,6 @@ use serde_json::{json, Value};
|
||||
|
||||
use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment};
|
||||
use proxmox::api::schema::*;
|
||||
use proxmox::tools::fs::CreateOptions;
|
||||
|
||||
use crate::api2::types::*;
|
||||
use crate::backup::*;
|
||||
@ -61,13 +60,7 @@ fn create_datastore(
|
||||
|
||||
let path: PathBuf = param["path"].as_str().unwrap().into();
|
||||
let backup_user = crate::backup::backup_user()?;
|
||||
let _store = ChunkStore::create(
|
||||
name,
|
||||
path,
|
||||
CreateOptions::new()
|
||||
.owner(backup_user.uid)
|
||||
.group(backup_user.gid),
|
||||
)?;
|
||||
let _store = ChunkStore::create(name, path, backup_user)?;
|
||||
|
||||
let datastore = json!({
|
||||
"path": param["path"],
|
||||
|
@ -85,7 +85,7 @@ impl ChunkStore {
|
||||
chunk_dir
|
||||
}
|
||||
|
||||
pub fn create<P>(name: &str, path: P, options: CreateOptions) -> Result<Self, Error>
|
||||
pub fn create<P>(name: &str, path: P, user: nix::unistd::User) -> Result<Self, Error>
|
||||
where
|
||||
P: Into<PathBuf>,
|
||||
{
|
||||
@ -98,6 +98,10 @@ impl ChunkStore {
|
||||
|
||||
let chunk_dir = Self::chunk_dir(&base);
|
||||
|
||||
let options = CreateOptions::new()
|
||||
.owner(user.uid)
|
||||
.group(user.gid);
|
||||
|
||||
let default_options = CreateOptions::new();
|
||||
|
||||
if let Err(err) = create_path(&base, Some(default_options.clone()), Some(options.clone())) {
|
||||
|
Loading…
Reference in New Issue
Block a user