public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] don't overwrite existing systemd mount unit
@ 2020-11-04 11:55 Fabian Ebner
  2020-11-05 12:45 ` Fabian Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2020-11-04 11:55 UTC (permalink / raw)
  To: pbs-devel

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 src/api2/node/disks/directory.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index 2a4780f2..c650b887 100644
--- a/src/api2/node/disks/directory.rs
+++ b/src/api2/node/disks/directory.rs
@@ -252,6 +252,11 @@ fn create_datastore_mount_unit(
     mount_unit_name.push_str(".mount");
 
     let mount_unit_path = format!("/etc/systemd/system/{}", mount_unit_name);
+    let full_path = std::path::Path::new(&mount_unit_path);
+
+    if full_path.exists() {
+        bail!("mount unit {} already exists!", mount_unit_path);
+    }
 
     let unit = SystemdUnitSection {
         Description: format!("Mount datatstore '{}' under '{}'", datastore_name, mount_point),
-- 
2.20.1





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-05 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 11:55 [pbs-devel] [PATCH proxmox-backup] don't overwrite existing systemd mount unit Fabian Ebner
2020-11-05 12:45 ` Fabian Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal