From 81e59bc9e315564ab89134c3bc496d20b0935157 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Wed, 8 Aug 2012 19:38:11 +0000 Subject: Check return codes when creating btrfs subvolumes or snapshots --- lib/Iurt/Chroot.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index 37ea892..7b75274 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -341,17 +341,18 @@ sub create_build_chroot_btrfs { if (check_chroot_need_update($chroot_ref, $run)) { sudo($config, '--btrfs_delete', $chroot_ref); - sudo($config, '--btrfs_create', $chroot_ref); # Check ! + if (!sudo($config, '--btrfs_create', $chroot_ref)) { + plog('ERROR', "creating btrfs subvolume failed."); + return; + } if (!build_chroot($run, $config, $chroot_ref)) { - plog('NOTIFY', "creating chroot failed."); + plog('ERROR', "creating chroot failed."); sudo($config, '--btrfs_delete', $chroot_ref); return; } } - sudo($config, '--btrfs_snapshot', $chroot_ref, $chroot); # Check ! - - 1; + sudo($config, '--btrfs_snapshot', $chroot_ref, $chroot); } sub build_chroot { -- cgit v1.2.1