diff --git a/Cargo.toml b/Cargo.toml index 019ea20c..0333ace2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ pam-sys = "0.5" percent-encoding = "2.1" pin-utils = "0.1.0" pathpatterns = "0.1.2" -proxmox = { version = "0.4.1", features = [ "sortable-macro", "api-macro", "websocket" ] } +proxmox = { version = "0.4.2", features = [ "sortable-macro", "api-macro", "websocket" ] } #proxmox = { git = "ssh://gitolite3@proxdev.maurer-it.com/rust/proxmox", version = "0.1.2", features = [ "sortable-macro", "api-macro" ] } #proxmox = { path = "../proxmox/proxmox", features = [ "sortable-macro", "api-macro", "websocket" ] } proxmox-fuse = "0.1.0" diff --git a/debian/control b/debian/control index 5bff7fc5..20f3f9c9 100644 --- a/debian/control +++ b/debian/control @@ -34,10 +34,10 @@ Build-Depends: debhelper (>= 11), librust-pathpatterns-0.1+default-dev (>= 0.1.2-~~), librust-percent-encoding-2+default-dev (>= 2.1-~~), librust-pin-utils-0.1+default-dev, - librust-proxmox-0.4+api-macro-dev (>= 0.4.1-~~), - librust-proxmox-0.4+default-dev (>= 0.4.1-~~), - librust-proxmox-0.4+sortable-macro-dev (>= 0.4.1-~~), - librust-proxmox-0.4+websocket-dev (>= 0.4.1-~~), + librust-proxmox-0.4+api-macro-dev (>= 0.4.2-~~), + librust-proxmox-0.4+default-dev (>= 0.4.2-~~), + librust-proxmox-0.4+sortable-macro-dev (>= 0.4.2-~~), + librust-proxmox-0.4+websocket-dev (>= 0.4.2-~~), librust-proxmox-fuse-0.1+default-dev, librust-pxar-0.6+default-dev (>= 0.6.1-~~), librust-pxar-0.6+futures-io-dev (>= 0.6.1-~~), diff --git a/src/api2/access/acl.rs b/src/api2/access/acl.rs index 96154226..3282c66e 100644 --- a/src/api2/access/acl.rs +++ b/src/api2/access/acl.rs @@ -175,7 +175,7 @@ pub fn update_acl( _rpcenv: &mut dyn RpcEnvironment, ) -> Result<(), Error> { - let _lock = open_file_locked(acl::ACL_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(acl::ACL_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let (mut tree, expected_digest) = acl::config()?; diff --git a/src/api2/access/user.rs b/src/api2/access/user.rs index 432a48e1..c041d804 100644 --- a/src/api2/access/user.rs +++ b/src/api2/access/user.rs @@ -100,7 +100,7 @@ pub fn list_users( /// Create new user. pub fn create_user(password: Option, param: Value) -> Result<(), Error> { - let _lock = open_file_locked(user::USER_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(user::USER_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let user: user::User = serde_json::from_value(param)?; @@ -211,7 +211,7 @@ pub fn update_user( digest: Option, ) -> Result<(), Error> { - let _lock = open_file_locked(user::USER_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(user::USER_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let (mut config, expected_digest) = user::config()?; @@ -285,7 +285,7 @@ pub fn update_user( /// Remove a user from the configuration file. pub fn delete_user(userid: Userid, digest: Option) -> Result<(), Error> { - let _lock = open_file_locked(user::USER_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(user::USER_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let (mut config, expected_digest) = user::config()?; diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs index 298dd252..07ca4ab8 100644 --- a/src/api2/config/datastore.rs +++ b/src/api2/config/datastore.rs @@ -112,7 +112,7 @@ pub fn list_datastores( /// Create new datastore config. pub fn create_datastore(param: Value) -> Result<(), Error> { - let _lock = open_file_locked(datastore::DATASTORE_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(datastore::DATASTORE_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let datastore: datastore::DataStoreConfig = serde_json::from_value(param.clone())?; @@ -277,7 +277,7 @@ pub fn update_datastore( digest: Option, ) -> Result<(), Error> { - let _lock = open_file_locked(datastore::DATASTORE_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(datastore::DATASTORE_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; // pass/compare digest let (mut config, expected_digest) = datastore::config()?; @@ -381,7 +381,7 @@ pub fn update_datastore( /// Remove a datastore configuration. pub fn delete_datastore(name: String, digest: Option) -> Result<(), Error> { - let _lock = open_file_locked(datastore::DATASTORE_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(datastore::DATASTORE_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let (mut config, expected_digest) = datastore::config()?; diff --git a/src/api2/config/remote.rs b/src/api2/config/remote.rs index 0f983450..faef51d6 100644 --- a/src/api2/config/remote.rs +++ b/src/api2/config/remote.rs @@ -79,7 +79,7 @@ pub fn list_remotes( /// Create new remote. pub fn create_remote(password: String, param: Value) -> Result<(), Error> { - let _lock = open_file_locked(remote::REMOTE_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(remote::REMOTE_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let mut data = param.clone(); data["password"] = Value::from(base64::encode(password.as_bytes())); @@ -195,7 +195,7 @@ pub fn update_remote( digest: Option, ) -> Result<(), Error> { - let _lock = open_file_locked(remote::REMOTE_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(remote::REMOTE_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let (mut config, expected_digest) = remote::config()?; @@ -256,7 +256,7 @@ pub fn update_remote( /// Remove a remote from the configuration file. pub fn delete_remote(name: String, digest: Option) -> Result<(), Error> { - let _lock = open_file_locked(remote::REMOTE_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(remote::REMOTE_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let (mut config, expected_digest) = remote::config()?; diff --git a/src/api2/config/sync.rs b/src/api2/config/sync.rs index 57192d90..a3aa0ec5 100644 --- a/src/api2/config/sync.rs +++ b/src/api2/config/sync.rs @@ -69,7 +69,7 @@ pub fn list_sync_jobs( /// Create a new sync job. pub fn create_sync_job(param: Value) -> Result<(), Error> { - let _lock = open_file_locked(sync::SYNC_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(sync::SYNC_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let sync_job: sync::SyncJobConfig = serde_json::from_value(param.clone())?; @@ -187,7 +187,7 @@ pub fn update_sync_job( digest: Option, ) -> Result<(), Error> { - let _lock = open_file_locked(sync::SYNC_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(sync::SYNC_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; // pass/compare digest let (mut config, expected_digest) = sync::config()?; @@ -250,7 +250,7 @@ pub fn update_sync_job( /// Remove a sync job configuration pub fn delete_sync_job(id: String, digest: Option) -> Result<(), Error> { - let _lock = open_file_locked(sync::SYNC_CFG_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(sync::SYNC_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?; let (mut config, expected_digest) = sync::config()?; diff --git a/src/api2/node/network.rs b/src/api2/node/network.rs index b125a8af..efdc8afd 100644 --- a/src/api2/node/network.rs +++ b/src/api2/node/network.rs @@ -241,7 +241,7 @@ pub fn create_interface( let interface_type = crate::tools::required_string_param(¶m, "type")?; let interface_type: NetworkInterfaceType = serde_json::from_value(interface_type.into())?; - let _lock = open_file_locked(network::NETWORK_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(network::NETWORK_LOCKFILE, std::time::Duration::new(10, 0), true)?; let (mut config, _digest) = network::config()?; @@ -505,7 +505,7 @@ pub fn update_interface( param: Value, ) -> Result<(), Error> { - let _lock = open_file_locked(network::NETWORK_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(network::NETWORK_LOCKFILE, std::time::Duration::new(10, 0), true)?; let (mut config, expected_digest) = network::config()?; @@ -646,7 +646,7 @@ pub fn update_interface( /// Remove network interface configuration. pub fn delete_interface(iface: String, digest: Option) -> Result<(), Error> { - let _lock = open_file_locked(network::NETWORK_LOCKFILE, std::time::Duration::new(10, 0))?; + let _lock = open_file_locked(network::NETWORK_LOCKFILE, std::time::Duration::new(10, 0), true)?; let (mut config, expected_digest) = network::config()?; diff --git a/src/config/jobstate.rs b/src/config/jobstate.rs index b35973a6..b609916c 100644 --- a/src/config/jobstate.rs +++ b/src/config/jobstate.rs @@ -97,7 +97,7 @@ where { let mut path = path.as_ref().to_path_buf(); path.set_extension("lck"); - let lock = open_file_locked(&path, Duration::new(10, 0))?; + let lock = open_file_locked(&path, Duration::new(10, 0), true)?; let backup_user = crate::backup::backup_user()?; nix::unistd::chown(&path, Some(backup_user.uid), Some(backup_user.gid))?; Ok(lock) diff --git a/src/server/worker_task.rs b/src/server/worker_task.rs index e6145cf8..a24e59b4 100644 --- a/src/server/worker_task.rs +++ b/src/server/worker_task.rs @@ -332,7 +332,7 @@ fn update_active_workers(new_upid: Option<&UPID>) -> Result, E let backup_user = crate::backup::backup_user()?; - let lock = open_file_locked(PROXMOX_BACKUP_TASK_LOCK_FN, std::time::Duration::new(10, 0))?; + let lock = open_file_locked(PROXMOX_BACKUP_TASK_LOCK_FN, std::time::Duration::new(10, 0), true)?; nix::unistd::chown(PROXMOX_BACKUP_TASK_LOCK_FN, Some(backup_user.uid), Some(backup_user.gid))?; let reader = match File::open(PROXMOX_BACKUP_ACTIVE_TASK_FN) {