From 729d41fe6a1b99b415c82ad05dfa4b481fe99d0d Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 30 Sep 2020 09:34:21 +0200 Subject: [PATCH] api: disks/zfs: check template exsits before enabling zfs-import service Signed-off-by: Thomas Lamprecht --- src/api2/node/disks/zfs.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs index 0f0e4220..16534199 100644 --- a/src/api2/node/disks/zfs.rs +++ b/src/api2/node/disks/zfs.rs @@ -357,8 +357,10 @@ pub fn create_zpool( let output = crate::tools::run_command(command, None)?; worker.log(output); - let import_unit = format!("zfs-import@{}.service", systemd::escape_unit(&name, false)); - systemd::enable_unit(&import_unit)?; + if std::path::Path::new("/lib/systemd/system/zfs-import@.service").exists() { + let import_unit = format!("zfs-import@{}.service", systemd::escape_unit(&name, false)); + systemd::enable_unit(&import_unit)?; + } if let Some(compression) = compression { let mut command = std::process::Command::new("zfs");